ID 357963 - Importing Nuke as a Python module into a third-party Python interpreter fails if you have plugins installed

Follow

Problem summary
Importing Nuke as a Python module into a third-party Python interpreter throws the following errors if you have plugins installed:



Customer reported version
nuke.10.5v2

Customer reported platform
windows10

Steps to reproduce

1) Firstly, you will need a third-party Python interpreter installed. For Nuke 11.2v1 you will need Python 2.7.13.

2) You will also need a plugin installed to the C:\Program Files\Common Files\Nuke\11.2 directory (CaraVR for example).

3) Open the command prompt and run the following command to start Python: "C:\Python27\python.exe"

4) Run the following lines of Python code to see the error:

>>> import sys>>> sys.path.append('C:\Program Files\Nuke11.2v1\lib\site-packages')>>> import nuke
Workaround
Simply renaming the plugins folder which is located in C:\Program Files\Common Files\Nuke\11.2 prevent Nuke from being able to locate any of your plugins and stop the error from occuring.

Reproduced by support
This bug has been reproduced in:
Nuke 11.2v1 - Windows 10
Nuke 11.1v4 - Windows 10
Nuke 11.1v1 - Windows 10
Nuke 11.0v4 - Windows 10
Nuke 11.0v1 - Windows 10
Nuke 10.5v7 - Windows 10
Nuke 10.5v1 - Windows 10
Nuke 10.0v6 - Windows 10
Nuke 10.0v1 - Windows 10 - Regression

Unable to reproduce bug in:
Nuke11.2v1 - Linux CentOS 7
Nuke 9.0v7 - Windows 10

Not tested on macOS due to Python compatibility issues.

Earliest version tested
Nuke 9.0v7
- This issue no longer appears in this version and has regressed

Expected behaviour
Nuke should be imported as a Python module with no errors.

Actual behaviour
Importing Nuke as a Python module into a third-party Python interpreter throws the following errors if you have plugins installed:


 

    We're sorry to hear that

    Please tell us why