Q100273: How to handle path substitutions for Nuke terminal sessions



You have set up your path substitutions under Edit > Preferences... in Nuke, but the file paths aren’t substituted correctly during command line rendering or Python Terminal mode. Your path substitutions would look like:




File paths may not be substituted correctly on a command line render or Python Terminal mode because Preferences aren't loaded when Nuke is run outside of GUI mode.

Terminal mode (without GUI) allows you to enter Python commands without launching the GUI.
A >>> command prompt is displayed during this mode. Command line mode (batch mode) allows you to run commands in the terminal to render your Nuke script (without GUI). 
Please see the Nuke Online Help on Command Line Operations for more information.



To solve this, you can use the command line argument --remap, which will take a list of path substitution pairs and work only for the active Nuke session, or set a filenameFilter callback in your init.py file to have it persistent across all Nuke sessions.  

Current Nuke session

Here is an example of how the flag is used when running Nuke in Terminal Mode:

nuke -t --remap "X:/path,Y:,A:,B:/anotherpath"


  • nuke references the appropriate Nuke executable installation location: 

    Windows: C:\Program Files\Nuke10.5v2\Nuke10.5.exe
    OSX: /Applications/Nuke10.5v2/Nuke10.5v2.app/Contents/MacOS/Nuke10.5v2
    Linux: /usr/local/Nuke10.5v2/Nuke10.5

  • Any paths starting with X:/path are converted to start with Y:.
  • Any paths starting with A: are converted to start with B:/anotherpath.

To substitute paths between different operating systems, your command would look for example like:

nuke -t --remap "/home/project/shot/,C:/project/shot" 

NOTE: The path mappings are only applied to the current Nuke session and they do not affect the Preferences.nk file used when running the Nuke GUI.

Multiple Nuke sessions

To make your path substitutions persistent across multiple Nuke sessions you can use the filenameFilter callback. More information on this can be found in the Nuke Python Developer Guide



Was this article helpful?
0 out of 0 found this helpful