Getting the Additional Python Search Paths in a plugin

It seems that the Additional Python Search Paths are not passed down to subprocesses.
For instance with the Nuke plugin, the Nuke subprocess does not have these search paths.

Also there isn’t a GetAdditionalPythonSearchPaths (or whatever) function anywhere, which would allow us to inject the paths in PYTHONPATH, e.g. with self.SetProcessEnvironmentVariable("PYTHONPATH", search_paths).

Am I missing anything? This makes the feature less useful than it could be.

Passing down the plugin’s sys.path does not work, because it includes a lot of other unnecessary paths, which actually breaks Nuke.
For now we’ll use JobPreLoad, but that means duplicating the paths in question.

Hello!

Additional Python Search Path option in Deadline Monitor > Tools > Configure Repository Options > Python Settings adds the search path to the sys.path under Deadline PythonSync cache.

I proved it by running the follow script to print sys.path(), you can add a Additional Python Search Path and save the below script as “path.py”:

import sys

def __main__():
    for path in sys.path:
        print(path)

You can run the script with deadlinecommand to print the python path.

deadlinecommand -ExecuteScript <Path\to\path.py>

If you want to add a path on the top of the sys.path(), you can add the below code:

sys.path.insert(0, <path>)

I hope this would help you.

Hi, I know this, the issue is that I want to access only the additional paths, without the paths under Deadline10 etc. which are incompatible with some programs.
Anyhow, overriding the Nuke plugin to inject those paths explicitly works, just slightly less clean.