State:New|TargetRelease:No Target|icon_bug|icon_nuke|database:public|Resolution:Fixed|BugID:559759|
Problem summary:
Nuke crashes in Terminal mode if a Python script creates a Read node after setting an OCIO config that references non-existent environment variables
Customer reported version:
Nuke 13.2v7
Customer reported platform:
Windows 10
Steps to reproduce:
1) Download the attached config_with_env_vars.ocio file.
2) Change the following ocio_path variable to the location of the config_with_env_vars.ocio file, and save this code in a .py file named "set_ocio_script.py" (or similar):
# Apply OCIO configocio_path = "path/to/the/config_with_env_vars.ocio"nuke_root = nuke.root()nuke_root.knob("customOCIOConfigPath").setValue(ocio_path)nuke_root.knob("colorManagement").setValue("OCIO")nuke_root.knob("OCIO_config").setValue("custom")nuke_root.knob("reloadConfig").execute()print("Root OCIO knobs set")read = nuke.createNode("Read")print("Read node created")3) Open Nuke in Terminal mode and execute the set_ocio_script.py file, using a command similar to the following:"C:\Program Files\Nuke15.0v2\Nuke15.0.exe" -t path/to/the/set_ocio_script.py4) Observe how Nuke crashes before the "Read node created" message is printed to the Terminal:
ERROR: oCIODisplay: The specified file reference '$<environment_variable>.cc' could not be located.

knobDefault code inside the ~/.nuke/init.py file to set the Root's OCIO knobs appears to prevent the crash:ocio_path = "path/to/the/custom/config_with_env_vars.ocio" nuke.knobDefault("Root.customOCIOConfigPath",ocio_path) nuke.knobDefault("Root.colorManagement","OCIO") nuke.knobDefault("Root.OCIO_config","custom")In which case, the set_ocio_script.py should be updated to look similar to the following: read = nuke.createNode("Read") print("Read node created") We're sorry to hear that
Please tell us why