ID 161006 - OCIO colorspace will not be applied to a Read node if generated at the same time using Terminal mode

Follow

Problem summary
An OCIO will not be applied correctly if it is set within Terminal mode within the same python script as the OCIO is set.

Customer reported version
nuke.10.0v6

Customer reported platform
centos7

Steps to reproduce
1) Download an OCIO configuration from a third party. A download to an open source solution can be found here: http://opencolorio.org/ in the downloads section as "sample OCIO configurations."
2) Choose a configuration within one of the subfolders. For example, aces_1.0.3
3) Assign a custom LUT config file to the OCIO environment variable. Instructions on how to do this for each operating system can be found here: https://support.foundry.com/hc/en-us/articles/205764002-Q100015-How-To-Set-Environment-Variables-
In this case, set the OCIO variable to: "/path/to/OCIO/config.OCIO" i.e. '/path/to/aces_1.0.3/config.ocio
4) Save the following script in a python file, replacing the path in line 6 with a valid image file on your system. A python script is simply saved out of a text editor, replacing the extension with ".py" i.e. testscript.py:

import nukex=nuke.root()x['colorManagement'].setValue('OCIO')r = nuke.createNode('Read')print rr['file'].fromUserText('/path/to/file/.ext')print r
5) Open a terminal window and load python from the Nuke directory and execute the python script. To do so,
a. Open a terminal,
b. Open a file explorer window. Navigate to the Nuke directory for the version of Nuke you wish to run. Drag and drop the python.exe or python executable file from this folder into the terminal window. Press "space" to leave a space after the command.
c. Next, in a file explorer navigate to your python script. Drag and drop the python script into the same terminal window as above. The resulting line should be "/path/to/nuke/pythonexecutable /path/to/script/testscript.py,"
d. Press enter to execute the script.
Result: The script should now run and the second read node's colorspace is set to default (linear) instead of the LUT's default. 

This same script works as expected (loads the configurations default colorspace) when executed line by line in a terminal window or in the Script Editor.

Nuke 9.0 defaults to Nuke LUT's even when environment variable is set.

Workaround
Run the script line by line or in the script editor in GUI mode.

Reproduced by support
Nuke 10.5v4 - Windows 10, Centos6, OSX 10.12.5
Nuke 10.0v6 - Windows 10, Centos6, OSX 10.12.5
Nuke 10.0v1 - Windows 10, Centos6

Note: This bug is not reproducible prior to Nuke 10 due to a different feature set.

Expected behaviour
Read node to be created with colorspace respecting OCIO defaults.

Actual behaviour
Read node created with colorspace set to default (linear) rather than the OCIO default.

    We're sorry to hear that

    Please tell us why