Modo PreRender Script (Execute a Python Script)


#1

Hello,
I’m attempting to run a Python (.py) file as a pre-render script before Modo renders. This python file is generated at the time the job is submitted to deadline and when executed will configure the scene based on values it queries from a database. I’ve modified the Modo plugin file to successfully execute an LXM (macro) file however there are certain tasks that require the use of a python script. Specifically, what to do when it tries to select an object not found in the scene file. I can watch the log output and the python executes everything within that .py file but when it completes it errors and doesn’t move on to rendering.

Maybe this is not the correct way to execute a python file within deadline?
self.SendCommand(execfile(’%s’ % self.python_configuration_file), True)

Any help would be greatly appreciated!

Error: TypeError : cannot concatenate ‘str’ and ‘NoneType’ objects (Python.Runtime.PythonException)

File "C:\Users\TRG\AppData\Local\Thinkbox\Deadline10\slave\trg-pc40\plugins\5d77df0b87c84708807e2e81\Modo_2.py", line 306, in RenderTasks

self.SendCommand(execfile(’%s’ % self.python_configuration_file), True)

File "C:\Users\TRG\AppData\Local\Thinkbox\Deadline10\slave\trg-pc40\plugins\5d77df0b87c84708807e2e81\Modo_2.py", line 386, in SendCommand

self.CreateCommandFile( self.JobFilename, "EXECUTE\n" + command )

at Deadline.Plugins.PluginWrapper.RenderTasks(String taskId, Int32 startFrame, Int32 endFrame, String& outMessage, AbortLevel& abortLevel)

Thanks,
David