Verbosity and IronPython in PostJobScript

I have created a PostJobScript step for a Maya plugin that converts rendered EXRs from the default Maya format to one that Nuke prefers. I wrote it originally in Python, tested it manually, but when I hooked it up as a PostJobScript I ran into two problems.

  1. I can not seem to capture any output from my script, to aid in debugging and progress reports. These two statements do not appear in the log. Perhaps I am looking in the wrong log.

def main():
ScriptUtils.LogText( “hello world”)
print ‘hello world’

  1. I did not realize that IronPython does not support the Python os module. I started to convert the script calls over to Iron Python, for example, instead of using the os module I did something like this:

Before:

# remove the temp dir if it exists, and then create it if os.path.exists(tmpDir): shutil.rmtree(tmpDir) os.mkdir(tmpDir)

After:

# remove the temp dir if it exists, and then create it if Directory.Exists(tmpDir): Directory.Delete(tmpDir,True) Directory.CreateDirectory(tmpDir)

… but I was unable to successfully convert it all, without the help of debug messages. I also explored trying to force the os module into IronPython by appending my sys path, like this:

import sys
sys.path.append(“pathtomypythonlib”)
import os

but I encountered errors with that as well.

I think the first step is figuring out why I cant get feedback into the logs.

Thanks for any suggestions!

Seth

Hey Seth,

You’ll want to use the global LogInfo function documented here:
software.primefocusworld.com/sof … l_Funtions

The LogText function only outputs to the application’s log file. We’ll be updating our Job Scripts documentation with the next release to use the LogInfo function instead.

Also, it is known that IronPython doesn’t work with all python libraries.

Cheers,

  • Ryan

Got it - that worked, thanks!

I got all my os module calls converted, thanks to the help of some debug messages!