Deadline can't authenticate script deadline_integration

I am trying to connect deadline 10.1.20.3 to shotgun and followed the instructions to set up a deadline integration script in Shotgun and added the API Key to deadline in the Shotgun event configuration, but I get an error during render that it can’t authenticate the deadline integration script. The test integration script works. And the create shotgun version script works. but not the deadline_integration. I assume it hasn’t ‘blessed’ the script? I am NOT using secrets management. I do have a PAT. What am I missing?

It works in general. You do not need a PAT for script users. It is some other detail. Got a full traceback of the failure?

Here is traceback:

=======================================================
Error

Event Error (OnJobSubmitted): AuthenticationFault : Can’t authenticate script ‘b’deadline_integration2’’

=======================================================
Type

PythonException

=======================================================
Stack Trace

File “none”, line 210, in OnJobSubmitted
File “none”, line 140, in CreateShotgunVersion
File “/Users/mgoetsch/Library/Application Support/Thinkbox/Deadline10/cache/AE8TNb1jzgr5p2YgSauzYq5SxM/events/Shotgun/ShotgunUtils.py”, line 333, in AddNewVersion
user = sg.find_one(“HumanUser”,filters=[[“login”,“is”,userName]],fields=[‘login’,‘name’])
File “/Users/mgoetsch/Library/Application Support/Thinkbox/Deadline10/pythonAPIs/GuKglf2daWWQuMxjuFjQKw==/shotgun_api3/shotgun.py”, line 882, in find_one
additional_filter_presets=additional_filter_presets)
File “/Users/mgoetsch/Library/Application Support/Thinkbox/Deadline10/pythonAPIs/GuKglf2daWWQuMxjuFjQKw==/shotgun_api3/shotgun.py”, line 1025, in find
records = self._call_rpc(“read”, params).get(“entities”, )
File “/Users/mgoetsch/Library/Application Support/Thinkbox/Deadline10/pythonAPIs/GuKglf2daWWQuMxjuFjQKw==/shotgun_api3/shotgun.py”, line 3314, in _call_rpc
self._response_errors(response)
File “/Users/mgoetsch/Library/Application Support/Thinkbox/Deadline10/pythonAPIs/GuKglf2daWWQuMxjuFjQKw==/shotgun_api3/shotgun.py”, line 3601, in _response_errors
raise AuthenticationFault(sg_response.get(“message”, “Unknown Authentication Error”))
at Python.Runtime.Dispatcher.Dispatch(ArrayList args)
at __FranticX_GenericDelegate1`1[[Deadline_Jobs_Job, deadline, Version=10_1_20_3, Culture=neutral, PublicKeyToken=5db103c5a9cd1f1e]]Dispatcher.Invoke(Job )
at Deadline.Events.DeadlineEventListener.OnJobSubmitted(Job job)
at Deadline.Events.DeadlineEventPlugin.OnJobSubmitted(Job job)

=======================================================
Log

2022-03-03 12:02:06: ‘/Users/mgoetsch/Library/Application Support/Thinkbox/Deadline10/pythonAPIs/TpInYK90tHRGHkkk07Og==’ already exists. Skipping extraction of PythonSync.
2022-03-03 12:02:06: INFO: Importing Shotgun API from ‘/Users/mgoetsch/Library/Application Support/Thinkbox/Deadline10/pythonAPIs/GuKglf2daWWQuMxjuFjQKw==’…
2022-03-03 12:02:06: INFO: Output path: /Volumes/R4i/Shotgun/projects/the_ferry/assets/Prop/coin1/MDL/work/maya/images/coin1_MDL.v003_v001_t01/coin1_MDL.v003__perspShape_beauty.####.exr
2022-03-03 12:02:06: An error occurred in the “OnJobSubmitted” function in events plugin ‘Shotgun’: AuthenticationFault : Can’t authenticate script ‘b’deadline_integration2’’ (Python.Runtime.PythonException)
2022-03-03 12:02:06: File “none”, line 210, in OnJobSubmitted
2022-03-03 12:02:06: File “none”, line 140, in CreateShotgunVersion
2022-03-03 12:02:06: File “/Users/mgoetsch/Library/Application Support/Thinkbox/Deadline10/cache/AE8TNb1jzgr5p2YgSauzYq5SxM/events/Shotgun/ShotgunUtils.py”, line 333, in AddNewVersion
2022-03-03 12:02:06: user = sg.find_one(“HumanUser”,filters=[[“login”,“is”,userName]],fields=[‘login’,‘name’])
2022-03-03 12:02:06: File “/Users/mgoetsch/Library/Application Support/Thinkbox/Deadline10/pythonAPIs/GuKglf2daWWQuMxjuFjQKw==/shotgun_api3/shotgun.py”, line 882, in find_one
2022-03-03 12:02:06: additional_filter_presets=additional_filter_presets)
2022-03-03 12:02:06: File “/Users/mgoetsch/Library/Application Support/Thinkbox/Deadline10/pythonAPIs/GuKglf2daWWQuMxjuFjQKw==/shotgun_api3/shotgun.py”, line 1025, in find
2022-03-03 12:02:06: records = self._call_rpc(“read”, params).get(“entities”, )
2022-03-03 12:02:06: File “/Users/mgoetsch/Library/Application Support/Thinkbox/Deadline10/pythonAPIs/GuKglf2daWWQuMxjuFjQKw==/shotgun_api3/shotgun.py”, line 3314, in _call_rpc
2022-03-03 12:02:06: self._response_errors(response)
2022-03-03 12:02:06: File “/Users/mgoetsch/Library/Application Support/Thinkbox/Deadline10/pythonAPIs/GuKglf2daWWQuMxjuFjQKw==/shotgun_api3/shotgun.py”, line 3601, in _response_errors
2022-03-03 12:02:06: raise AuthenticationFault(sg_response.get(“message”, “Unknown Authentication Error”))
2022-03-03 12:02:06: at Python.Runtime.Dispatcher.Dispatch(ArrayList args)
2022-03-03 12:02:06: at __FranticX_GenericDelegate11\[\[Deadline_Jobs_Job\, deadline\, Version=10_1_20_3\, Culture=neutral\, PublicKeyToken=5db103c5a9cd1f1e\]\]Dispatcher.Invoke(Job ) 2022-03-03 12:02:06: at Deadline.Events.DeadlineEventListener.OnJobSubmitted(Job job) 2022-03-03 12:02:06: at Deadline.Events.DeadlineEventPlugin.OnJobSubmitted(Job job) (Deadline.Events.DeadlineEventPluginException) 2022-03-03 12:02:06: at Deadline.Events.DeadlineEventPlugin.b(String cbr, Exception cbs) 2022-03-03 12:02:06: at Deadline.Events.DeadlineEventPlugin.OnJobSubmitted(Job job) 2022-03-03 12:02:06: at Deadline.Events.DeadlineEventManager.OnJobSubmitted(Job job, DataController dataController) 2022-03-03 12:02:06: ---------- Inner Stack Trace (Python.Runtime.PythonException) ---------- 2022-03-03 12:02:06: File "none", line 210, in OnJobSubmitted 2022-03-03 12:02:06: File "none", line 140, in CreateShotgunVersion 2022-03-03 12:02:06: File "/Users/mgoetsch/Library/Application Support/Thinkbox/Deadline10/cache/AE8TNb1jzgr5p2YgSauzYq5SxM/events/Shotgun/ShotgunUtils.py", line 333, in AddNewVersion 2022-03-03 12:02:06: user = sg.find_one("HumanUser",filters=[["login","is",userName]],fields=['login','name']) 2022-03-03 12:02:06: File "/Users/mgoetsch/Library/Application Support/Thinkbox/Deadline10/pythonAPIs/GuKglf2daWWQuMxjuFjQKw==/shotgun_api3/shotgun.py", line 882, in find_one 2022-03-03 12:02:06: additional_filter_presets=additional_filter_presets) 2022-03-03 12:02:06: File "/Users/mgoetsch/Library/Application Support/Thinkbox/Deadline10/pythonAPIs/GuKglf2daWWQuMxjuFjQKw==/shotgun_api3/shotgun.py", line 1025, in find 2022-03-03 12:02:06: records = self._call_rpc("read", params).get("entities", []) 2022-03-03 12:02:06: File "/Users/mgoetsch/Library/Application Support/Thinkbox/Deadline10/pythonAPIs/GuKglf2daWWQuMxjuFjQKw==/shotgun_api3/shotgun.py", line 3314, in _call_rpc 2022-03-03 12:02:06: self._response_errors(response) 2022-03-03 12:02:06: File "/Users/mgoetsch/Library/Application Support/Thinkbox/Deadline10/pythonAPIs/GuKglf2daWWQuMxjuFjQKw==/shotgun_api3/shotgun.py", line 3601, in _response_errors 2022-03-03 12:02:06: raise AuthenticationFault(sg_response.get("message", "Unknown Authentication Error")) 2022-03-03 12:02:06: at Python.Runtime.Dispatcher.Dispatch(ArrayList args) 2022-03-03 12:02:06: at __FranticX_GenericDelegate11[[Deadline_Jobs_Job, deadline, Version=10_1_20_3, Culture=neutral, PublicKeyToken=5db103c5a9cd1f1e]]Dispatcher.Invoke(Job )
2022-03-03 12:02:06: at Deadline.Events.DeadlineEventListener.OnJobSubmitted(Job job)
2022-03-03 12:02:06: at Deadline.Events.DeadlineEventPlugin.OnJobSubmitted(Job job)

=======================================================
Details

Date: 03/03/2022 12:02:06
Event Type: OnJobSubmitted
Job Submit Date: 03/03/2022 12:02:05
Job User: mgoetsch

I think I saw this somewhere recently - notice that the username is a byte string (the b' prefix).
Python 3 is more strict in the distinction between byte strings and “regular” strings.
Could you try
userName.decode("utf-8")
when passing in the name? (somewhere around line 333)

This fails because userName is a str.

=======================================================
Error

Event Error (OnJobSubmitted): AttributeError : ‘str’ object has no attribute ‘decode’

=======================================================
Type

PythonException

=======================================================
Stack Trace

File “none”, line 210, in OnJobSubmitted
File “none”, line 140, in CreateShotgunVersion
File “/Users/mgoetsch/Library/Application Support/Thinkbox/Deadline10/cache/AE8TNb1jzgr5p2YgSauzYq5SxM/events/Shotgun/ShotgunUtils.py”, line 333, in AddNewVersion
user = sg.find_one(“HumanUser”,filters=[[“login”,“is”,userName.decode(“utf-8”)]],fields=[‘login’,‘name’])
at Python.Runtime.Dispatcher.Dispatch(ArrayList args)
at __FranticX_GenericDelegate1`1[[Deadline_Jobs_Job, deadline, Version=10_1_20_3, Culture=neutral, PublicKeyToken=5db103c5a9cd1f1e]]Dispatcher.Invoke(Job )
at Deadline.Events.DeadlineEventListener.OnJobSubmitted(Job job)
at Deadline.Events.DeadlineEventPlugin.OnJobSubmitted(Job job)

=======================================================
Log

2022-03-14 17:49:44: INFO: Importing Shotgun API from ‘/Users/mgoetsch/Library/Application Support/Thinkbox/Deadline10/pythonAPIs/GuKglf2daWWQuMxjuFjQKw==’…
2022-03-14 17:49:44: INFO: Output path: /Volumes/R4i/Shotgun/projects/the_ferry/assets/Prop/hornet/TXT/work/maya/images/hornet_TXT.v004_v001_t02/hornet_TXT.v004__perspShape_beauty.####.exr
2022-03-14 17:49:44: An error occurred in the “OnJobSubmitted” function in events plugin ‘Shotgun’: AttributeError : ‘str’ object has no attribute ‘decode’ (Python.Runtime.PythonException)
2022-03-14 17:49:44: File “none”, line 210, in OnJobSubmitted
2022-03-14 17:49:44: File “none”, line 140, in CreateShotgunVersion
2022-03-14 17:49:44: File “/Users/mgoetsch/Library/Application Support/Thinkbox/Deadline10/cache/AE8TNb1jzgr5p2YgSauzYq5SxM/events/Shotgun/ShotgunUtils.py”, line 333, in AddNewVersion
2022-03-14 17:49:44: user = sg.find_one(“HumanUser”,filters=[[“login”,“is”,userName.decode(“utf-8”)]],fields=[‘login’,‘name’])
2022-03-14 17:49:44: at Python.Runtime.Dispatcher.Dispatch(ArrayList args)
2022-03-14 17:49:44: at __FranticX_GenericDelegate11\[\[Deadline_Jobs_Job\, deadline\, Version=10_1_20_3\, Culture=neutral\, PublicKeyToken=5db103c5a9cd1f1e\]\]Dispatcher.Invoke(Job ) 2022-03-14 17:49:44: at Deadline.Events.DeadlineEventListener.OnJobSubmitted(Job job) 2022-03-14 17:49:44: at Deadline.Events.DeadlineEventPlugin.OnJobSubmitted(Job job) (Deadline.Events.DeadlineEventPluginException) 2022-03-14 17:49:44: at Deadline.Events.DeadlineEventPlugin.b(String cbr, Exception cbs) 2022-03-14 17:49:44: at Deadline.Events.DeadlineEventPlugin.OnJobSubmitted(Job job) 2022-03-14 17:49:44: at Deadline.Events.DeadlineEventManager.OnJobSubmitted(Job job, DataController dataController) 2022-03-14 17:49:44: ---------- Inner Stack Trace (Python.Runtime.PythonException) ---------- 2022-03-14 17:49:44: File "none", line 210, in OnJobSubmitted 2022-03-14 17:49:44: File "none", line 140, in CreateShotgunVersion 2022-03-14 17:49:44: File "/Users/mgoetsch/Library/Application Support/Thinkbox/Deadline10/cache/AE8TNb1jzgr5p2YgSauzYq5SxM/events/Shotgun/ShotgunUtils.py", line 333, in AddNewVersion 2022-03-14 17:49:44: user = sg.find_one("HumanUser",filters=[["login","is",userName.decode("utf-8")]],fields=['login','name']) 2022-03-14 17:49:44: at Python.Runtime.Dispatcher.Dispatch(ArrayList args) 2022-03-14 17:49:44: at __FranticX_GenericDelegate11[[Deadline_Jobs_Job, deadline, Version=10_1_20_3, Culture=neutral, PublicKeyToken=5db103c5a9cd1f1e]]Dispatcher.Invoke(Job )
2022-03-14 17:49:44: at Deadline.Events.DeadlineEventListener.OnJobSubmitted(Job job)
2022-03-14 17:49:44: at Deadline.Events.DeadlineEventPlugin.OnJobSubmitted(Job job)

=======================================================
Details

Date: 03/14/2022 17:49:44
Event Type: OnJobSubmitted
Job Submit Date: 03/14/2022 17:49:44
Job User: mgoetsch

Oh wait, this is Python 2, so ignore my comment.

I think I saw it - the Shotgun integration is looking for a HumanUser, but deadline_integration is a script user. Quoting from ShotgunUtils.py:

user = sg.find_one("HumanUser",filters=[["login","is",userName]],fields=['login','name'])

I’d have to investigate further to figure this out.

1 Like

Hello I am just following up. We are having the same issue here. We were able to connect via the legacy connection settings, but would rather be able to move forward without having to generate a key for individual users. Any help is appreciated!!

1 Like

I was not able to get this to work, unfortunately.

1 Like

You can just try to hack ShotgunUtils.py to look for a ScriptUser instead of a HumanUser.

@mgoetsch
so i was having this problem as well i found a fix. not sure if it is the most elegant of fixes but it works.
so within your events/Shotgun folder in your repo openthe ShotgunUtils.py file.
go to line 90 and replace the function GetShotgunForEventPlugin
with the Fallowing code.
any changes i made have been marked with DML EDIT


def GetShotgunForEventPlugin( url, proxy, config ):
    # type: (str, Optional[bytes], PluginConfig) -> Shotgun
    if LoginInfo.ShotgunInstance:
        try:
            # DML EDIT check if the current shotgrid can connect
            LoginInfo.ShotgunInstance.find_one("Project",filters=[])
            # DML EDIT if so then there is a good connection
            return LoginInfo.ShotgunInstance
        except:
            # DML EDIT if not then we force it to connect again
            pass
    name = SafeEncode( config.GetConfigEntry( 'ShotgunScriptName' ) )

    dataController = DeadlineApplicationManager.GetBaseInstance().DataController
    secretsManagementEnabled = dataController.SecretsManagementEnabled
    if secretsManagementEnabled:
        key = SafeEncode( dataController.SecretsManagementController.GetSecret('/events/Shotgun/ShotgunScriptKey') )
    else:
        key = SafeEncode( config.GetConfigEntry( 'ShotgunScriptKey' ) )

    if proxy == b"":
        proxy = None

    #sgObject = shotgun_api3.shotgun.Shotgun( url, name, key, True, proxy, connect=False )
    # DML EDIT convert the name and key into put strings instead of bitcode strings
    sgObject = shotgun_api3.shotgun.Shotgun( url, name.decode("utf-8"), key.decode("utf-8"), True, proxy, connect=False )
    LoginInfo.Debug( "Connected to Shotgun using API key" )
    return sgObject

how this helps

1 Like