Shotgun.py / python26 DLL cannot be found

Hello,

recently, I experience multiple problems with Deadline, Draft and Shotgun. Now, I think it’s all related to one error message I get whenever I submit my jobs out of Nuke.

Events plugin 'Shotgun' could not be loaded from the repository because: Error executing event plugin script "\\mg02\deadlinerepository5\events\Shotgun\Shotgun.py": Unable to load DLL 'python26': The specified module could not be found. (Exception from HRESULT: 0x8007007E)(Deadline.Events.DeadlineEventPluginException)

Well, that sounds like a problem :smiley:! The issues I had for around two months now, atleast I remember noticing back then, are:

  1. Nuke can’t submit Draft jobs anymore (but Shotgun versions are still created!).
  2. When submitting Draft jobs inside the Deadline Monitor (right clicking on a rendered job /Scripts/Submit Draft Job) the slates’ fields contain “undefined” instead of Shotgun attributes and the output movie is not uploaded to Shotgun. At the end of the Draft job there is one logged error:

[code]=======================================================
Error Message

TypeError : int() argument must be a string or a number, not ‘NoneType’

=======================================================
Slave Log

An error occurred in the “OnJobFinished” function in events plugin ‘Shotgun’: An error occurred in function “OnJobFinished” the event plugin script file “\mg02\deadlinerepository5\events\Shotgun\Shotgun.py”: TypeError : int() argument must be a string or a number, not ‘NoneType’
Python Exception: TypeError : int() argument must be a string or a number, not ‘NoneType’ (Python.Runtime.PythonException)
Type: <type ‘exceptions.TypeError’>
Value: int() argument must be a string or a number, not ‘NoneType’
Stack Trace:
[’ File “none”, line 172, in OnJobFinished\n’]
(Deadline.Events.DeadlineEventPluginException)
at Deadline.Events.DeadlineEventPlugin.HandlePythonError(String message, Exception e)
at Deadline.Events.DeadlineEventPlugin.OnJobFinished(Job job, String[] auxiliaryFilenames)
at Deadline.Events.DeadlineEventManager.OnJobFinished(Job job, String[] auxiliaryFilenames, DeadlineController deadlineController)

=======================================================
Error Type

PythonException

=======================================================
Error Stack Trace

[’ File “none”, line 172, in OnJobFinished\n’]
[/code]

I personally can’t remember someone changing anything in the Shotgun.py but I am not sure about that (maybe someone could have a look at it if there’s an invalid argument regarding versionId).

The mentioned line in the Shotgun.py looks like following:

ShotgunUtils.UpdateVersion( int(versionId), statusCode, shotgunPath )

And the part where versionId is defined:

[code] versionId = None
try:
# Use ShotgunUtils ot add a new version to Shotgun.
newVersion = ShotgunUtils.AddNewVersion( userName, taskId, projectId, entityId, entityType, version, description, frameList, frameCount, outputPath, shotgunPath, job.JobId )
versionId = newVersion[‘id’]
ClientUtils.LogText( "Created new version in Shotgun with ID " + str(versionId) + ": " + version )

			# Save the version ID with the job for future events.
			job.SetJobExtraInfoKeyValue( "VersionId", str(versionId) )
			RepositoryUtils.SaveJob( job )
		except:
			if verboseLogging:
				raise
			else:
				ClientUtils.LogText( "An error occurred while attempting to add a new Version to Shotgun.  No Version has been created." )
				return None
		
		return versionId[/code]

While I am at it anyway I’m going to upload the .py. I’d love to hear your ideas on what could cause the problem. Thanks, thanks, thanks!
Before I forget: the “missing” python26.dll is here “\mg02\deadlinerepository5\python\Windows\2.6.7\x64” (is that correct?).

Best regards,
Dziga
Shotgun.zip (3.42 KB)

That sounds super weird. Given what you’re describing, I’d agree with you that the initial message (the one regarding python26) seems to be the cause of all this pain; it could certainly be the cause of the TypeError you mentioned later on. The event plugin you zipped up doesn’t seem to have any special modifications in it, so that shouldn’t be the problem.

With regards to the Python install, there should be a copy of it client as well as the one you found on the repository. It should be under the Deadline install folder on your local machine, I would definitely check if that is still intact. If it is, I would maybe try (temporarily) explicitly adding the relevant python folder to your System PATH (the path should be something like ‘C:\Program Files\Thinkbox\Deadline\python\2.6.7\x64’). If that works, there might either be another Python install somewhere mucking things up, or Deadline isn’t properly determining the bitness of your system for some reason.

Also, could you zip up a copy of a Job file that was demonstrating those Shotgun problems? You can find the job file by right-click a job in the Monitor, and selecting ‘Explore Repository Directory’. It’ll be a file that is named something like this: ‘000_025_000_742ea86b.job’.

Have you tried re-installing the Deadline client at all? If not, I think it might be worth a shot.

  • Jon

Hi Jon,

that’s all really weird indeed. Our freelance programmer is inhouse today and we’ll look at a possible cause I found yesterday regarding the PYTHON PATH environment variable that was set to an old location that doesn’t exist anymore. The local python files are in place. I still attach a recent job file of mine.

Thanks and best regards,
Dziga

EDIT: Adding the local python install to the PATH variable got rid of the error, but our programmer is not a friend of the idea to explicitly forcing the path to this one and only python directory. So, we’re still looking for a solution besides this temporary fix. I’m waiting for my job to finish rendering now to see if this solves the uploading issue, too.

EDIT#2:

When submitting my job out of Nuke with “Create Shotgun version” and “Create Draft job” checked the submission doesn’t show errors. In the Monitor I only get the normal job but no Draft job. The Shotgun version is created and a thumbnail is added after rendering has finished. Then I tried to manually submit a Draft job out of the Monitor but after completion I still get the python TypeError mentioned above.
000_050_999_61420cc0.zip (15.9 KB)

For what it’s worth, I definitely agree with your programmer, which is why we actually add our Python install to the PATH dynamically (and only for that context) whenever we need to launch our interpreter. Since it’s working when you put it in explicitly, that must mean that the bit of code which is supposed to do that isn’t working properly for you guys. I’m not entirely sure why that would be… It could be that the internal folder structure was changed, but I highly doubt someone would’ve mucked with that (on all the machines, to boot). I’ll have to look into what else could be causing this to fail, now that we’ve narrowed down what the problem is.

As for the TypeError you get at the end of a Draft job, I just realized that is a bug, and is totally my fault :frowning:. The Shotgun Event plugin actually shouldn’t be executing for the Draft job at all, since it’s not creating a version (hence the error). We handle the video upload with a post-job script on the Draft job, instead of through the SG Event Plugin (I might change that in the future, but that’s how it currently works). I’ll fix this asap and get you an updated event plugin once I do (hopefully later today).

Cheers,

  • Jon

Here’s the updated version of the Shotgun event plugin. It should eliminate the error you’ve been seeing in your Draft jobs. Just extract the file to ‘events/Shotgun/Shotgun.py’ in your repo.

Still looking into the main issue, though. I’ll post again when I have an update.

Cheers,

Alright, I think I figured out the problem. If it’s what I think it is, it’s a problem with a change we made to delay the initialization of Python until we needed it (it also matches your timeline of the problem cropping up). Unfortunately, it will require a binary update, so you’ll have to wait for our next Beta build to be posted for this to be fixed. I spoke with Ryan and we can probably release one early next week.

Cheers,

  • Jon

Looking forward to the update! Thank you.

Best regards,
Dziga