AWS Thinkbox Discussion Forums

"No Module Named Draft"

I was trying to run through a script to crop frames automatically as part of a draft job, but when I try to import Draft it fails repeatedly. The error I get from running Deadline is “No Module Named Draft”.

I found this thread which got me to try running Draft.py by itself. And I got the same error as above.
It seemed like the person in that thread had a more nuanced problem than me so I couldn’t find anything else that might help me there. Is there a step in installation that was missed or some manual script set up that I was meant to perform?

We’ve noticed this occasionally when, for some reason, “Draft” is found elsewhere, but isn’t the correct or full Draft. Could you run the script draft\Samples\Diagnostics\check_Draft_install.py script and let me know the output from the job report? (The deadline submitter will require you to specify an input file… pick whatever, the script won’t actually look at it.)

Thanks!
Andrea

Sure thing Andrea. I just opened it in the Python GUI, but that doesn’t make a difference right?

Here’s the result:

[code]****** Attempting to import Draft. ******
*** “import Draft” failed, error message: ***
No module named Draft

****** Attempting to find Draft. ******

*** Problem finding Draft module, error message: ***
No module named Draft

****** printing diagnostic information ******

sys.version = 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)]
sys.version_info = sys.version_info(major=2, minor=7, micro=9, releaselevel=‘final’, serial=0)
sys.api_version = 1013
sys.platform = win32
sys.prefix = C:\Python27
sys.meta_path = []

sys.path:
C:\DeadlineRepository7\draft\Samples\Diagnostics
C:\Python27\Lib\idlelib
C:\Python27\python27.zip
C:\Python27\DLLs
C:\Python27\lib
C:\Python27\lib\plat-win
C:\Python27\lib\lib-tk
C:\Python27
C:\Python27\lib\site-packages
C:\Python27\lib\site-packages\win32
C:\Python27\lib\site-packages\win32\lib
C:\Python27\lib\site-packages\Pythonwin

os.environ:
TMP = C:\Users\ntreanor\AppData\Local\Temp
COMPUTERNAME = CS-COMP-045
USERDOMAIN = CS-Comp-045
PSMODULEPATH = C:\Windows\system32\WindowsPowerShell\v1.0\Modules
COMMONPROGRAMFILES = C:\Program Files (x86)\Common Files
PROCESSOR_IDENTIFIER = Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
PROGRAMFILES = C:\Program Files (x86)
PROCESSOR_REVISION = 3a09
SYSTEMROOT = C:\Windows
HOME = C:\Users\ntreanor
COM.ADOBE.VERSIONCUE.CLIENT.APPVERSION = 1.0.0
WINDOWS_TRACING_FLAGS = 3
TK_LIBRARY = C:\Python27\tcl\tk8.5
TEMP = C:\Users\ntreanor\AppData\Local\Temp
COMSPEC = C:\Windows\system32\cmd.exe
COMMONPROGRAMFILES(X86) = C:\Program Files (x86)\Common Files
COM.ADOBE.VERSIONCUE.CLIENT.APPNAME = AdobeDrive
PROCESSOR_ARCHITECTURE = x86
PROGRAMFILES(X86) = C:\Program Files (x86)
TIX_LIBRARY = C:\Python27\tcl\tix8.4.3
ALLUSERSPROFILE = C:\ProgramData
LOCALAPPDATA = C:\Users\ntreanor\AppData\Local
HOMEPATH = \Users\ntreanor
PROGRAMW6432 = C:\Program Files
USERNAME = gchadwick
LOGONSERVER = \CS-COMP-045
SESSIONNAME = Console
PROGRAMDATA = C:\ProgramData
TCL_LIBRARY = C:\Python27\tcl\tcl8.5
PATH = C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Dell\Dell Data Protection\Access\Advanced\Wave\Gemalto\Access Client\v5;C:\Program Files (x86)\NTRU Cryptosystems\NTRU TCG Software Stack\bin;C:\Program Files\NTRU Cryptosystems\NTRU TCG Software Stack\bin;C:\Program Files (x86)\Common Files\Adobe\AGL;C:\Program Files (x86)\QuickTime\QTSystem;C:\Program Files\Intel\Intel® Management Engine Components\DAL;C:\Program Files\Intel\Intel® Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel® Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel® Management Engine Components\IPT;C:\Python27
PATHEXT = .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.py;.pyw
FP_NO_HOST_CHECK = NO
WINDIR = C:\Windows
DEADLINE_PATH = C:\Program Files\Thinkbox\Deadline7\bin
WINDOWS_TRACING_LOGFILE = C:\BVTBin\Tests\installpackage\csilogfile.log
HOMEDRIVE = C:
SYSTEMDRIVE = C:
COM.ADOBE.VERSIONCUE.CLIENT.APPLOCALE = en_US
NUMBER_OF_PROCESSORS = 8
APPDATA = C:\Users\ntreanor\AppData\Roaming
PROCESSOR_LEVEL = 6
PROCESSOR_ARCHITEW6432 = AMD64
COMMONPROGRAMW6432 = C:\Program Files\Common Files
OS = Windows_NT
PUBLIC = C:\Users\Public
USERPROFILE = C:\Users\ntreanor[/code]

Thanks!

Deadline automatically sets some environment variables which I don’t see set here, so the results won’t be the same. In your earlier test, were you running through deadline, or just through Python? If through Python, the problem is that you need to set a few environment variables. I’ll post those when I get in to work in a bit.

Also, just to check, which version of Deadline (or Draft) are you using? This affects which version of Python you need to use, which is why I’m asking.

Cheers,
Andrea

When I first found this earlier it was running through Deadline, with an event plug in for launching Draft. The log I posted was from running the check_Draft_install file from IDLE Python GUI, but I tried the command line too and got a similar result but I’ll paste that here too just in case.

Also I’m using Deadline 7 and Python 2.7.

[code]****** Attempting to import Draft. ******
*** “import Draft” failed, error message: ***
No module named Draft

****** Attempting to find Draft. ******

*** Problem finding Draft module, error message: ***
No module named Draft

****** printing diagnostic information ******

sys.version = 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)]

sys.version_info = sys.version_info(major=2, minor=7, micro=9, releaselevel=‘fin
al’, serial=0)
sys.api_version = 1013
sys.platform = win32
sys.prefix = c:\Python27
sys.meta_path = []

sys.path:
c:\deadlinerepository7\draft\samples\diagnostics
c:\Python27\python27.zip
c:\Python27\DLLs
c:\Python27\lib
c:\Python27\lib\plat-win
c:\Python27\lib\lib-tk
c:\Python27
c:\Python27\lib\site-packages
c:\Python27\lib\site-packages\win32
c:\Python27\lib\site-packages\win32\lib
c:\Python27\lib\site-packages\Pythonwin

os.environ:
TMP = C:\Users\ntreanor\AppData\Local\Temp
COMPUTERNAME = CS-COMP-045
USERDOMAIN = CS-Comp-045
PSMODULEPATH = C:\Windows\system32\WindowsPowerShell\v1.0\Modules
COMMONPROGRAMFILES = C:\Program Files (x86)\Common Files
PROCESSOR_IDENTIFIER = Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
PROGRAMFILES = C:\Program Files (x86)
PROCESSOR_REVISION = 3a09
SYSTEMROOT = C:\Windows
PATH = C:\ProgramData\Oracle\Java\javapath;C:\Program Files
(x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\Windows\system3
2;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0
;C:\Program Files\Dell\Dell Data Protection\Access\Advanced\Wave\Gemalto\Access
Client\v5;C:\Program Files (x86)\NTRU Cryptosystems\NTRU TCG Software Stack\bi
n;C:\Program Files\NTRU Cryptosystems\NTRU TCG Software Stack\bin;C:\Program F
iles (x86)\Common Files\Adobe\AGL;C:\Program Files (x86)\QuickTime\QTSystem;C:
Program Files\Intel\Intel® Management Engine Components\DAL;C:\Program Files\I
ntel\Intel® Management Engine Components\IPT;C:\Program Files (x86)\Intel\Inte
l® Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel® Mana
gement Engine Components\IPT;C:\Python27
PROGRAMFILES(X86) = C:\Program Files (x86)
COMSPEC = C:\Windows\system32\cmd.exe
TEMP = C:\Users\ntreanor\AppData\Local\Temp
COMMONPROGRAMFILES(X86) = C:\Program Files (x86)\Common Files
PROCESSOR_ARCHITECTURE = x86
ALLUSERSPROFILE = C:\ProgramData
LOCALAPPDATA = C:\Users\ntreanor\AppData\Local
HOMEPATH = \Users\ntreanor
PROGRAMW6432 = C:\Program Files
USERNAME = gchadwick
LOGONSERVER = \CS-COMP-045
PROMPT = $P$G
WINDOWS_TRACING_FLAGS = 3
PROGRAMDATA = C:\ProgramData
PATHEXT = .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MS
C;.py;.pyw
FP_NO_HOST_CHECK = NO
WINDIR = C:\Windows
DEADLINE_PATH = C:\Program Files\Thinkbox\Deadline7\bin
WINDOWS_TRACING_LOGFILE = C:\BVTBin\Tests\installpackage\csilogfile.log
HOMEDRIVE = C:
SYSTEMDRIVE = C:
NUMBER_OF_PROCESSORS = 8
APPDATA = C:\Users\ntreanor\AppData\Roaming
PROCESSOR_LEVEL = 6
PROCESSOR_ARCHITEW6432 = AMD64
COMMONPROGRAMW6432 = C:\Program Files\Common Files
OS = Windows_NT
PUBLIC = C:\Users\Public
USERPROFILE = C:\Users\ntreanor
[/code]

Hi Gary,

I’m stuck at the mechanics right now, answering this on my phone. Can you submit the script from the deadline monitor? From the submit menu, select “Draft submission”.

To run from the command line or Python IDE, you’ll nee to set PYTHONPATH and IMAGE_MAGICK_PATH to include the Draft module directory. (There might be something else as well, but try those two to start, or submit from the deadline monitor.)

Ah understood. Here’s the job report from running the script within Deadline. It does seem to find the module fine here:

[code]=======================================================
Log

2015-02-02 18:06:41: BEGIN - CS-COMP-045\gchadwick
2015-02-02 18:06:41: 0: Start Job timeout is disabled.
2015-02-02 18:06:41: 0: Task timeout is disabled.
2015-02-02 18:06:41: 0: Loaded job: Untitled (54cfbc83edaac91c1c17c2ac)
2015-02-02 18:06:41: 0: INFO: Executing plugin script C:\Users\ntreanor\AppData\Local\Thinkbox\Deadline7\slave\CS-COMP-045\plugins\54cfbc83edaac91c1c17c2ac\Draft.py
2015-02-02 18:06:41: 0: INFO: Found Draft python module at: ‘C:\Users\ntreanor\AppData\Local\Thinkbox\Deadline7\slave\CS-COMP-045\Draft\Draft.pyd’
2015-02-02 18:06:41: 0: INFO: About: Draft Plugin for Deadline
2015-02-02 18:06:41: 0: INFO: The job’s environment will be merged with the current environment before rendering
2015-02-02 18:06:41: 0: Plugin rendering frame(s): 1-142
2015-02-02 18:06:42: 0: INFO: Draft job starting…
2015-02-02 18:06:42: 0: INFO: Stdout Handling Enabled: True
2015-02-02 18:06:42: 0: INFO: Popup Handling Enabled: False
2015-02-02 18:06:42: 0: INFO: Using Process Tree: True
2015-02-02 18:06:42: 0: INFO: Hiding DOS Window: True
2015-02-02 18:06:42: 0: INFO: Creating New Console: False
2015-02-02 18:06:42: 0: INFO: Running as user: gchadwick
2015-02-02 18:06:42: 0: INFO: Looking for bundled python at: ‘C:\Program Files\Thinkbox\Deadline7\bin\dpython.exe’
2015-02-02 18:06:42: 0: INFO: Executable: “C:\Program Files\Thinkbox\Deadline7\bin\dpython.exe”
2015-02-02 18:06:42: 0: INFO: Argument: -u “C:\DeadlineRepository7\draft\Samples\Diagnostics\check_Draft_install.py” username="" entity="" version="" frameList=1-142 startFrame=1 endFrame=142 outFolder=“C:\Users\ntreanor\Desktop\Example_ASP\output\Draft” outFile=“C:\Users\ntreanor\Desktop\Example_ASP\output\Draft\file.mov” inFile=“C:\Users\ntreanor\Desktop\Example_ASP\output\file_#####.png” deadlineRepository=“C:\DeadlineRepository7” taskStartFrame=1 taskEndFrame=142
2015-02-02 18:06:42: 0: INFO: Startup Directory: “C:\Users\ntreanor\AppData\Local\Thinkbox\Deadline7\slave\CS-COMP-045\Draft”
2015-02-02 18:06:42: 0: INFO: Process Priority: BelowNormal
2015-02-02 18:06:42: 0: INFO: Process Affinity: default
2015-02-02 18:06:42: 0: INFO: Process is now running
2015-02-02 18:06:42: 0: STDOUT: ****** Attempting to import Draft. ******
2015-02-02 18:06:42: 0: STDOUT: Checking for a license…
2015-02-02 18:06:42: 0: STDOUT: Draft 1.2.3.57201
2015-02-02 18:06:42: 0: STDOUT: *** Draft imported successfully! You’re good to go! ***
2015-02-02 18:06:42: 0: STDOUT: Draft version 1.2.3.57201
2015-02-02 18:06:42: 0: STDOUT: Note: If you are getting errors when running a Draft script, look for errors in the script, or with the input to the script.
2015-02-02 18:06:43: 0: INFO: Process exit code: 0
2015-02-02 18:06:43: 0: INFO: Draft job complete!

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

Date: 02/02/2015 18:06:43
Frames: 1-142
Job Submit Date: 02/02/2015 18:05:55
Job User: gchadwick
Average RAM Usage: 0 (0%)
Peak RAM Usage: 0 (0%)
Average CPU Usage: 0%
Peak CPU Usage: 0%
Used CPU Clocks: 0
Total CPU Clocks: 0

=======================================================
Slave Information

Slave Name: CS-COMP-045
Version: v7.0.2.3 R (24b5c0a7f)
Operating System: Windows 7 Professional (SP1)
Machine User: gchadwick
IP Address: 192.168.3.199
MAC Address: 90:B1:1C:75:CB:DD
CPU Architecture: x64
CPUs: 8
CPU Usage: 7%
Memory Usage: 3.0 GB / 8.0 GB (37%)
Free Disk Space: 209.974 GB (130.490 GB on C:, 79.484 GB on E:)
Video Card: NVIDIA Quadro FX 580
[/code]

Also there’s no rush on getting an answer now, I’m about to go home for the day so I wont have access to my work computer until the morning (I’m in Ireland). So it wont make much difference to me if your response has to take hours.
Thanks!

Okay… looking at the output you posted, the following two environment variable settings should be correct:

PYTHONPATH=C:\DeadlineRepository7\draft\Windows\64bit
MAGICK_CONFIGURE_PATH=C:\DeadlineRepository7\draft\Windows\64bit

The third environment variable you’ll need to set is LM_LICENSE_FILE, which I don’t have sufficient information for. If you run the diagnostics script once more through Deadline, and add -v to the additional args, your output will include what you need to set LM_LICENSE_FILE to.

Let me know if you have additional questions, or run into more problems.

Cheers,
Andrea

Ok Andrea, I’ve run through the diagnostics script again with that argument and gotten the licence path now.
The only thing I’m unsure about is where I would set those environment variables though. I tried to find a place where PYTHONPATH and MAGICK_CONFIGURE_PATH were configured but I don’t see them anywhere.
If you can point me to where I can put in the licence path then I can try that out, thanks!

Since it looks like you’re using Windows, I’ll give the Windows style instructions.

There are multiple options, depending on the type of persistence you want.

Persistent on one computer

Open a File Explorer Window, and, in the left hand side, right-click “This PC” -> Properties -> Advanced System Settings -> Advanced tab -> Environment Variables

I have PYTHONPATH and MAGICK_CONFIGURE_PATH set in the user variables, and LM_LICENSE_FILE in the system variables. To add a new variable, click “New…” and enter the variable name and value. If you already have a variable, say, for PYTHONPATH, select it, click “Edit…” then add a semi-colon after the existing path(s), then the new path. Note: don’t add spaces, they can cause problems.

Once your variables are entered, click “OK”, and any new command prompts should see the new variables. (Command prompt windows already open won’t see the new variables.) You will likely need to restart your Python IDE.

Persistent only for a single Command Prompt window

At the command prompt, type:

set VARIABLE_NAME=value Where “VARIABLE_NAME” and “value” are substituted with the correct names & values. You will need to do this once per variable. Note that again there are no spaces around the equal sign.

Setting environment variables in a script

If you don’t have permission to set the environment variables for the computer, and you don’t want to keep setting them in the command prompt, it is also possible to set them within the script. (I recommend using the other methods, though.)

See this page in the python documentation on how to set environment variables from a script: https://docs.python.org/2/library/os.html

Python IDE

I’m not sure which Python IDE you’re using, but it may have a settings panel that allows you to set some environment variables too. Check the documentation for your IDE.

Ok well I went ahead and added those three through system settings as suggested. But that seems to have broken something with the existing ones that means it can no longer import System modules like System.Diagnostics let alone the Draft ones. Instead it tells me there is no module named “System.Diagnostics”.
I made sure that I put all three in with the right names and paths, I made sure I didn’t accidentally include any ''s at the end of path names and I made sure to use semicolons to separate the variables with multiple paths but it still seems to have broken.

I have to leave the office and wont be back until morning (my time) to look this over more but if it sounds like there’s any errors jumping out at you from that, it’d help me a lot.
Thanks!
Gary

Open up a command prompt, and type the following line:

env > env.txt then post env.txt here, either copy & paste, or attach the text file. (You can copy & paste from the command line too, if you’d rather, but it’s more of a pain than from a text file.)

Also, what IDE / GUI are you using? (And is the problem from within the GUI, or at the command line?)

Sorry if I made it unclear earlier but the intended use is to run a script from within deadline. However I have been testing with the IDLE Python GUI.

I worked through some errors and eventually discovered I accidentally had 32 bit Python installed instead of 64 bit, so upon reinstalling that I got Draft importing modules and functioning fine from the GUI. It throws no errors and I could successfully crop and save a new version of an image.

But, there’s trouble within Deadline’s job reports. Even though I can import Draft fine now, when I try calling ‘Draft.Image’ it says
"AttributeError: ‘module’ object has no attribute ‘Image’
Is it possible that Deadline is searching in the wrong place even though IDLE knows where to find it?

Also I’m not sure it matters now since the IDLE GUI is running fine, but the commandline is telling me that ‘env’ is not recognised, so I didn’t get any output from trying that.

Yeah, I guessed that you were testing within the GUI, but were eventually going to switch over to Deadline. I just wasn’t sure what permissions you had on your computer, and so wanted to give you some options.

I’m glad you’ve got Draft working within IDLE. (When you say “env” wasn’t recognized, was that at the Windows Command Prompt window, or inside the IDLE shell? It could be that “env” works for me because I have cygwin installed. It looks like “set” is the Windows equivalent. But that’s beside the point now.)

Yes, the way Deadline looks for Draft is different than how IDLE does. Is that script you e-mailed me in the support ticket the one that is giving the error? Or is it a standard Draft submission that’s giving the error? If it’s a standard Draft submission, I’m going to ask you to run the diagnostic script again. If it’s the script you e-mailed me, I’m going to have to consult with a few people…

Yeah, the script I emailed to you is giving the error about not finding Image as a module of Draft. It can Import Draft but it seems like it doesn’t find any Image module.

I’ve found it does work with the sample Draft scripts that the repository has. I could successfully create a job that just resizes the frames when I queued it up. So it seems it’s something specific to how that script tries to access Image.

We’ve had other users experience this sort of problem inside of the submission scripts. It seems that the python is finding something else called Draft that isn’t Draft. (Probably the Draft.py event script.) Looking at that thread you found before, and a ticket another user had, options are:

  • renaming ‘[repo]/events/Draft’ and its containing files to ‘DraftEvent’. The filenames need to match the name of the folder to be found correctly.
  • restart the slave
  • I think I’ve seen some ways to hack python to effectively unload a module, but it’s not officially supported

But yeah, I recommend using Draft in completely separate scripts. I’m going to ask Jon to look at your ticket, and see if your new workflow looks good, or if he has other suggestions.

Privacy | Site terms | Cookie preferences