Deadline Nuke plugin syntax error?

Hello there!

I’m using Deadline 10.2.0.10, I just upgraded from Deadline 8.
When I submit a Nuke job with BatchMode=True and ScriptJob=True, I get syntax error:

Error: FailRenderException : SyntaxError: unmatched ')'
   at Deadline.Plugins.DeadlinePlugin.FailRender(String message) (Python.Runtime.PythonException)
  File "C:\ProgramData\Thinkbox\Deadline10\workers\*****\plugins\6437f80ec94451eb36045475\Nuke.py", line 224, in RenderTasks
    self.WritePython( "with open(\"{}\") as f: exec(compile(f.read(), \"{}\", 'exec'), globals(), locals()))".format(scriptFileName, scriptFileName) )

This is caused by the following, original code:

    def RenderTasks( self ):
        
        if self.BatchMode and self.ScriptJob:
            scriptFileName = self.GetPluginInfoEntry( "ScriptFilename" ).replace( "\\", "/" )
            
            self.WritePython( "with open(\"{}\") as f: exec(compile(f.read(), \"{}\", 'exec'), globals(), locals()))".format(scriptFileName, scriptFileName) )

It seems like there’s an extra ‘)’ in the vanilla Nuke.py. I’m really confused, because I don’t think there can a mistake here, because then lots of people would have the same issue. However it really seems like a syntax error to me.

And even if I fix this, by removing the extra ‘)’, I get the next error, where it states, that the result of ReadyForInputCommand has a syntax error right at the p of the print.

    def ReadyForInputCommand(self):
        return "print( \"READY FOR INPUT\\n\" )"

I think these might be connected, but I’m confused by this whole situation. How can this out-of-the-box script not work for me?!

Thanks for the answers in advance!

Hello

I tested it on the Python interpreter, it works for me:

>>> def ReadyForInputCommand(self):
...         return "print( \"READY FOR INPUT\\n\" )"
...
>>>
>>>
>>> blah =1
>>> ReadyForInputCommand(blah)
'print( "READY FOR INPUT\\n" )'

What error are you getting?

Hello @zainali!

For the ReadyForInputCommand i get the following syntax error message:

=======================================================
Error
=======================================================
Error: FailRenderException : SyntaxError: invalid syntax
   at Deadline.Plugins.DeadlinePlugin.FailRender(String message) (Python.Runtime.PythonException)
  File "C:\ProgramData\Thinkbox\Deadline10\workers\*\plugins\64381b5cc94451eb360454aa\Nuke.py", line 227, in RenderTasks
    self.WritePython("with open(\"{}\") as f: exec(compile(f.read(), \"{}\", 'exec'), globals(), locals())".format(scriptFileName, scriptFileName))
  File "C:\ProgramData\Thinkbox\Deadline10\workers\*\plugins\64381b5cc94451eb360454aa\Nuke.py", line 44, in WritePython
    self.WaitForProcess()
  File "C:\ProgramData\Thinkbox\Deadline10\workers\*\plugins\64381b5cc94451eb360454aa\Nuke.py", line 51, in WaitForProcess
    self.FlushMonitoredManagedProcessStdout(self.ProcessName)
  File "C:\ProgramData\Thinkbox\Deadline10\workers\*\plugins\64381b5cc94451eb360454aa\Nuke.py", line 625, in HandleError
    self.deadlinePlugin.FailRender(self.GetRegexMatch(0))
   at Python.Runtime.Dispatcher.Dispatch(ArrayList args)
   at __FranticX_GenericDelegate0Dispatcher.Invoke()
   at Deadline.Plugins.DeadlinePlugin.RenderTasks()
   at Deadline.Plugins.DeadlinePlugin.DoRenderTasks()
   at Deadline.Plugins.PluginWrapper.RenderTasks(Task task, String& outMessage, AbortLevel& abortLevel)
   at Deadline.Plugins.PluginWrapper.RenderTasks(Task task, String& outMessage, AbortLevel& abortLevel)

and then at the end:

image

Do you have any idea about any of these issues?

There is indeed an extra paren in the first example.
The first thing that comes to mind is that the indentation of print might be wrong.

But it’s the official Nuke.py code, coming with the Deadline Repository installer.
Is this a faulty release with bugs? Is there an official fix for these problems?

However I would be surprised if trivial errors such as an extra parenthesis would make it to being released.

Hello,

It is the official Nuke.py code, but I think a lot of little issues were introduced when python2 phased out. This forum is a great way to share info if the error you get happens to be a bug.

I’m not a dev./pipeline person, but maybe you can test substituting this on line ~224 – which I think is the equiv. py3 (except I’ve left out their “format” part, which may account for the wayward paren)

self.WritePython("with open(scriptFileName) as f: exec(compile(f.read(), scriptFileName, 'exec'), globals(), locals())")

The previous code was python2:
self.WritePython( "execfile(\"%s\")" % scriptFileName )

Hopefully someone who is better at python can chime in.

Hello @pw_smn

You are basically getting the same error of extra parenthesis. This is so weird the syntax is fixed though but still failing on the same line. Please delete the Worker’s cache: Worker — Deadline 10.2.1.1 documentation

And retry.

Please attach you Nuke.py in which you have fixed the first syntax error.

Dear @zainali !

So here’s the original file:
Nuke.py (33.7 KB)

And here’s mine, only one parenthesis changed:
Nuke - Copy.py (33.7 KB)

When the syntax is fixed, then as I said, I get the next error with the print from

    def ReadyForInputCommand(self):
        return "print( \"READY FOR INPUT\\n\" )"

image

It doesn’t seem like the same error to me, so Worker cache isn’t relevant here.

I checked in Deadline 10.2.1.1 too. It’s still the same code in Nuke.py with the extra parenthesis.
How come no one else is having trouble with this?!

Hello @pw_smn

There is a specific workflow for Nuke where that Syntax error is thrown, I think it is when the Nuke script is used. There is an internal ticket to fix it, already in the system.

Apart from the parenthesis issue, I was not able to reproduce the syntax issue with the print statement. I need to look at the full job report: Controlling Jobs — Deadline 10.2.1.1 documentation which has that syntax error. If you are not comfortable sharing it here because of confidential information you can cut us a ticket from here: https://support.thinkboxsoftware.com/

What version of Nuke are you using? I am asking because it may be possible that you are using a version of Nuke which does not support Python3 and it breaking to run the Print statement.

As a quick test, run one Worker in Py2 mode and retry. Here’s how to run the Worker in Py2 mode: Python 3 Upgrade Guide — Deadline 10.2.1.1 documentation

P.S. worker’s cache automatically flushes out when a job type is changed, if it is not then you may have make changes in the plugin but they wont be copied from the Repo to Worker if the cache is still there.

2 Likes

Yes, as I stated in my original question, this happens when I submit a Nuke job with BatchMode=True and ScriptJob=True.

I’m using Nuke 14.0v2 with Python3. And also all my relevant codes are in Python 3.