Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch for making sever.py work with Nuke10.x #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

apetrynet
Copy link

As mentioned in your issue tracker I've been having trouble running this package in Nuke10.x. Some digging traced the issue to this part of the server code.
After using this for a while without issues and getting a "blessing" from The Foundry (like they can't see anything wrong with doing it this way) I thought I'd submit this pull request.

Here is a quote from The Foundry support on why nuke.executeInMainThreadWithResult() behaves differently in Nuke10.x:

I have asked our developers about why this happens in newer versions of Nuke, and they said this was a deliberate change as in some situations Nuke would error silently in the background when calling nuke.executeInMainThread() in the main thread, so this error message was added to prevent this occurrence.

Added a test for version and call object directly if nuke version is above 9.x. 
Not sure what (if any) issues this might cause, but sees to behave in my tool using this package.

I've filed a bug report at The Foundry regarding calls to nuke.executeInMainThreadWithResult() not working the same way in Nuke10.x.
@flecoq
Copy link

flecoq commented Jun 14, 2018

Hi apertrynet,
Tank you for your response.
Unfortunatly, i've just test the correction on Nuke11.1v4 -> the appli crashed :(

In the zip attached:

  • the server.py corrected (line 196)
  • the python script
  • the crash screenshot

the python command:
set PYTHONPATH=C:/Python27/Lib;C:/Python27/DLLs;C:/Python27/Lib/lib-tk;C:/Program Files/Nuke11.1v4/plugins;C:/assembler/nuke & C:/Users/user/Documents/Assembler/documentation/use_case_basical/assembler/script/nuke/createNodeTest_begin.py

Thank you for your help :)

nuke 11.zip

@apetrynet
Copy link
Author

apetrynet commented Jun 14, 2018

Hmmm..
I haven't tried it in Nuke11.1v4 yet, but have it running in 11.1v3. Please note that I run it outside of the GUI. Also please note that I use linux so my Windows-fu is a bit weak :/

I have to double check this when I get in to work tomorrow, but I seem to recall first having to run the server as one process and then connect to it with another. In my case I start one python thread with the server and another connects to it.
You can try something similar by opening one terminal (Comand prompt in windows?) and run the windows equivalent to: Nuke11.1 -t server.py and another terminal with: Nuke11.1 -t createNodeTest_begin.py It should work.
If not, please provide a Traceback from the script editor in Nuke or the command line so I can see what's going on.

PS! Make sure you have the NUKE_PATH and PYTHONPATH environment variables set to find the NukeExternalControl package and that you have a valid license as well. In -t (Terminal mode) Nuke uses a render license.

@flecoq
Copy link

flecoq commented Jun 14, 2018

I work with a trial version. So the terminal mode is not allowed :(

C:\Program Files\Nuke11.1v4>Nuke11.1.exe -t C:\Program Files\Nuke11.1v4\plugins\nukeExternalControl\server.py
Nuke 11.1v4, 64 bit, built Jun 7 2018.
Copyright (c) 2018 The Foundry Visionmongers Ltd. All Rights Reserved.
FOUNDRY LICENSE ERROR REPORT

Timestamp: Thu Jun 14 21:49:58 2018
License(s) Requested:
nuke 2018.0606 render only with options all
Extended Info: None Provided
Host : users
System ID(s) : 708bcd4e1a17 , 16f26dd6c116 , f4f26dd6c116
RLM Environment Info: C:\Users\user\FoundryLicensing\708bcd4e1a17;C:\Program Files\The Foundry\RLM;C:\ProgramData\The Foundry\RLM;C:\Program Files (x86)\The Fou
ndry\RLM;C:\Users\user\FoundryLicensing

Reason for failure: A suitable license does not exist.

RLM LICENSE DIAGNOSTICS

nuke_r : No license for product (-1)
License Path:
C:\Users\user\FoundryLicensing\708bcd4e1a17;C:\Program Files\The Foundry\RLM;C:\ProgramData\The Foundry\RLM;C:\Program Files (x86)\The Foundry\RLM;C:\Users\user
\FoundryLicensing;C:\ProgramData\The Foundry\RLM

@apetrynet
Copy link
Author

Ah, that might explain it then :)
There is a flag that forces nuke to use an interactive license, but I can't remember it at the moment and I'm not sure it helps in your case. Try: Nuke11.1.exe -h for a list of options.

@flecoq
Copy link

flecoq commented Jun 14, 2018

When i simply run nuke (not in terminal mode), the application takes into account the server.py in the \plugins\nukeExternalControl folder, doesn't it ?

So, before your correction, when i run my script:

set PYTHONPATH=C:/Python27/Lib;C:/Python27/DLLs;C:/Python27/Lib/lib-tk;C:/Program Files/Nuke11.1v4/plugins;C:/assembler/nuke & C:/Users/user/Documents/Assembler/documentation/use_case_basical/assembler/script/nuke/createNodeTest_begin.py

I take the error in my terminal:

C:\Program Files\Nuke11.1v4>set PYTHONPATH=C:/Python27/Lib;C:/Python27/DLLs;C:/Python27/Lib/lib-tk;C:/Program Files/Nuke11.1v4/plugins;C:/assembler/nu
ers/user/Documents/Assembler/documentation/use_case_basical/assembler/script/nuke/createNodeTest_begin_2.py
Traceback (most recent call last):
File "C:\Users\user\Documents\Assembler\documentation\use_case_basical\assembler\script\nuke\createNodeTest_begin_2.py", line 18, in
nuke.toNode("read").setXpos(0)
AttributeError: 'NoneType' object has no attribute 'setXpos'

and the nuke terminal send this error too:

File "C:/Program Files/Nuke11.1v4/plugins/nuke/executeInMain.py", line 19, in
r = _nuke.RunInMainThread.result(id)
SystemError: error return without exception set

With a nuke version < 10, it works fine.

Then, if i run the same test with your correction, the appli crash.

So do you think running the test in terminal mode should bring some complementary informations ?

Thank you very much for your help :)

@apetrynet
Copy link
Author

When i simply run nuke (not in terminal mode), the application takes into account the server.py in the \plugins\nukeExternalControl folder, doesn't it ?

I think you still need to actively run the server from within Nuke GUI before calling the connection script unless you do so in init.py or menu.py.
Have you tried following the guide in the README

With a nuke version < 10, it works fine.

Are you agree with that case ?

I'm not exactly sure what you're saying here. Were you successful in running the NukeExternalControl in Nuke9.x?
Or are you asking me if it will work in Nuke9.x?
If so, you'll run into the same issues regarding license and order of running your scripts in earlier versions of Nuke as well. The patch only solves the communication between server and client.

@flecoq
Copy link

flecoq commented Jun 14, 2018

It works for me with the Nuke9.x. I already use it for different projects from few years.

You're right, i've modify the menu.py according to the README too.

My question "Are you agree with that case ?" was about the error type nuke send before your correction:

File "C:/Program Files/Nuke11.1v4/plugins/nuke/executeInMain.py", line 19, in
r = _nuke.RunInMainThread.result(id)
SystemError: error return without exception set

@apetrynet
Copy link
Author

OK, then assume you have a valid license for Nuke9.x and that's why it works.
The error I got before the patch was: "RuntimeError: Invalid function call in non-gui mode"

@flecoq
Copy link

flecoq commented Jun 15, 2018

Yes, i have a license for Nuke9.x
So, you think it does no work on Nuke11.1v4 because i've just have a trial version ?

@apetrynet
Copy link
Author

apetrynet commented Jun 15, 2018 via email

@flecoq
Copy link

flecoq commented Jun 15, 2018

All right. In this case, i will not use the v11.4 for the moment.

I'm working on a pipeline project base on XML script for executing modelisation and rendering process on 3ds max, maya an nuke. I will show you a demo soon if your are interested :)

@apetrynet
Copy link
Author

Cool!
Good luck with your project!

If you send me something perhaps open a ticket in my repo so we don't bother the good people at Nvizible too much with off topic issues :)

@flecoq
Copy link

flecoq commented Jul 31, 2018

could you send me your repo link to post a ticket ?
Thank you so much !

@apetrynet
Copy link
Author

here's my repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants