I’ve done successful tests using draft submissions, but whenever I try and use draft in a post job script I get a " ‘module’ object has no attribute ‘Image’" error.
Here’s the basic post job script
[code]import re
from System.IO import *
from Deadline.Scripting import *
import sys
import Draft
def main( *args ):
inFile = “C:/images/image.jpg”
# print dir(Draft) # no complaints doing this
frame = Draft.Image.ReadFromFile(inFile)
[/code]
and here’s the error report
I was able to reproduce the issue. Currently Draft will not be able to load within the pre/post render job scripts in Deadline. I am looking into where the issue lies, but I can definitely say that Draft will be unable to run in that Python context.
Normally, you would submit an actual Deadline Draft job that is dependent on your original job. Would that work in your case? There are other hacks that we could use to get around it as well.
EDIT: What we could do is have a post-job-script that creates a new Draft Deadline job. I can give you sample code to do that if you would like.
Cool, just checking I wasn’t missing something simple.
The main aim is to do some basic resizing of still renders once they finish, which is easily done with a Deadline Draft job dependent on the render job, however it would be a tiny bit easier to integrate with our existing workflow if it could happen in a post job script so I thought I’d give it a go first. Either we’ll go for a separate Draft Job, or maybe use PIL in a post job script.
This might be a dumb hack, but you could run Python in a fresh context from the post-process-script. Something like this (Note: I didn’t test this code specifically, but the idea should work):
### my_resize_script.py
import sys
sys.path.append( "your_deadline_repo/draft/Windows/64bit" )
import Draft
inputFilename = sys.argv[0]
#do some draft resizing and save
Then in Deadline, your post-job-script could launch that standalone script:
Hmm would probably do the job… feels a bit naughty though, think I’ll go the PIL route.
If I install python modules such as PIL to the Deadline python will they always persist between Deadline upgrades, or does it depend on the scale of the update?
Well, normally when you install PIL, it will put the PIL library in the site-packages directory of Python. However, probably the easiest way to do it in Deadline would be to configure the Python settings at the repository level. Like so:
In the monitor, go to Tools > Configure Repository Options > Python Settings
From there you would add an additional search path to include wherever your PIL library resides. You could have it on a shared network location for example, then you wouldn’t have to install it on any of the slaves.