From: Greg Ercolano <erco@(email surpressed)>
Subject: [Q+A] Python submit script not running Nuke on windows, perl script works fine
   Date: Fri, 10 Jul 2015 14:05:52 -0400
Msg# 2396
View Complete Thread (2 articles) | All Threads
Last Next
> We're using the new python scripts and they work OK, but not with Nuke.
> When it executes nuke, it fails. It wasn't saying why, so we added some
> diagnostics and found it was complaining that it couldn't find the executable,
> but the executable is in the PATH correctly:
>
>     Executing: nuke8.0  -x //SKYNET/projects_2012/pipeline/2d/nuke/oflares_8.nk  4,4
>
>     --- RETRY #2 of 3
>
>     Executing: nuke8.0  -x //SKYNET/projects_2012/pipeline/2d/nuke/oflares_8.nk  4,4
>     ..this repeats..
>
> In our submit_nuke.py script we define the NUKECMD and PATH this way:
>
>      os.environ["NUKECMD"] = "nuke8.0
>      os.environ["PATH"]    = ( "c:/Program Files/Nuke8.0v3;"
>                              + os.environ["PATH"]
>                              )
>
> The equivalent settings work fine in the perl version of the nuke submit script.
> What is wrong here?

	After some investigation, the issue is Python's subprocess.call()
	which seems to be mistaking the ".0" in the "nuke8.0" command
	as a filename extension, preventing it from automatically trying to add
	the ".exe" extension.

	Normally, Windows does this automatically.
	But for some reason, the python subprocess.call() is confused by this.

SOLUTION:

	The simple solution was to change this line in the submit script:

    BEFORE:      os.environ["NUKECMD"] = "nuke8.0
     AFTER:      os.environ["NUKECMD"] = "nuke8.0.exe"		# <-- SPECIFY THE ".exe"

	This solved the issue.

	Not sure if this is a bug or a feature in subprocess.call(),
	but including the ".exe" definitely solved it.

	You don't run into this if the command is just "nuke", in other words, if
	the command doesn't contain dots.


   From: Greg Ercolano <erco@(email surpressed)>
Subject: Re: [Q+A] Python submit script not running Nuke on windows, perl script works fine
   Date: Fri, 10 Jul 2015 14:29:09 -0400
Msg# 2397
View Complete Thread (2 articles) | All Threads
Last Next

 When it executes nuke, it fails. It wasn't saying why, so we added some
 diagnostics and found it was complaining that it couldn't find the executable..

    Oh, and to solve that issue..

    Seems the python nuke submit script "submit_nuke.py" in Rush 103.07 (and older)
    omits checking for command not found errors.

     To fix that, add the following lines (shown in green):



        # License error?
        if exitcode == 100:
            sys.stderr.write("--- NUKE LICENSE ERROR: EXITCODE=%d\n" % exitcode)

            # Licpause+Retry?
            if fields["LicenseBehavior"] == "Licpause+Retry":
                sys.stderr.write("--- LICENSE PAUSE + RETRY\n")
                Rush.RunCommand("rush -fu -licpause > " + Rush.DevNull() + " 2>&1")
                Rush.RunCommand("rush -fu -notes " + os.environ["RUSH_FRAME"] + ':"'
                               +'license error (licpause)" > " + Rush.DevNull() + " 2>&1')
                sys.exit(2)

        # Other error
        sys.stderr.write("--- NUKE FAILED: EXITCODE=%d, ERRMSG=%s\n" % (exitcode, errmsg))

    # Failed all retries? Handle retry behavior
    if ( fields["RetryBehavior"] == "AddNever+Requeue" ):               # REQUEUE/FAIL



    Note the indent level is critical in python; those two lines should be indented 8 spaces.
    Again, this is specific to the submit_nuke in 103.07 or older.

    Both issues mentioned in this thread will be fixed in the next Rush release (103.08),
    yet to be announced.