When I launch nuke in gui mode I run a python script at startup by feeding the first the py script as the first argument to the executable
CMD >> Nuke8.0 startup.py
Within this file I am determining paths based on environment variables and doing
Functions within this module can create auto write nodes that name themselves according to our naming convention and auto make their output folders if they don’t exist, so a render doesn’t fail.
All of this works within the gui.
When setting up a python render script for Rush render queue, I’m using the nuke python interp (python.exe from within the nuke install folder)
so that from within that interp i can use the nuke module
(I started the standard way of just trying to launch the nuke executable with the -x option but had many more issues there. I’d like ot )
My rush script does all the same stuff my startup script does, adding paths to sys.path
But when I use something like
myModule.makeOutputFolder() as the prerender python script of a Write node, it claims that myModule is not defined, and the render fails.
How is this possible???
Here is a very simple version of what I’m doing in the render side of my rush script
import sys, os import nuke os.environ['NUKE_GIZMO_PATH'] = GIZMO_PATH # This works and nuke will find my gizmos sys.path.append(PATH_TO_MODULE) import myModule # This works, and the current env can use it, # but if the nuke script uses it, it can't find it nuke.openScript("myScript.nk") nuke.execute("myWriteNode") # Fails because writeNode can't find myModule
Its as if nuke.execute() does not work within the same environment so it doesn’t have the same modules imported
Why would it have access to os.environ but not have access to modules already imported?
Windows 7 x64