AWS Thinkbox Discussion Forums

PYTHONPATH replaced with default

I’m trying to use external Python scripts in Draft, but the PYTHONPATH gets set to default before running the Draft script.
I did add the Python path I wanted in Deadline Monitor -> Tools -> Configure Repository Options -> Python Settings, but it didn’t make a difference.
I can fix this by going into the Draft plugin script and adding it there, but it would still be better to not have to do this every time Deadline gets an upgrade.

Can you not do it at the start of your draft script? (Not the submission script, but the script you want to run through Deadline.) http://stackoverflow.com/questions/3108285/in-python-script-how-do-i-set-pythonpath

I’ve done it this way before, but the problem with this is that I have to put this boilerplate code at the top of every Draft script. Not saying that it doesn’t work, but being able to add to PYTHONPATH, I only have to do this in one place and then it works for everything.

Weird, the Draft plugin is supposed to deal with this by taking the current PYTHONPATH value and passing it on, but I can definitely see that this isn’t quite working the way we initially expected.

Fortunately, it should be easy to fix this in the Draft plugin. Basically, look for these lines in the Plugin (located at ‘plugins/Draft/Draft.py’ in your repository):

newPythonPath = self.DraftDirectory if Environment.GetEnvironmentVariable( "PYTHONPATH" ) != None: newPythonPath = newPythonPath + Path.PathSeparator + Environment.GetEnvironmentVariable( "PYTHONPATH" )

and replace them with this:

import sys newPythonPath = self.DraftDirectory + os.pathsep + os.pathsep.join( sys.path )

I’ve tested this and using sys.path instead of checking the Environment variable directly does correctly pull any Paths added to Deadline’s extra Python search path (in Repo Options).

Let me know if you have any questions!

  • Jon

That works! Thank you very much. Much better

Privacy | Site terms | Cookie preferences