RunProcess command help

Hello,

I’m trying to use the deadline equivalent of subprocess in a pre-job script (as it appears to fail to import subprocess module).

I want to apply a python patch to scene files before it is render with slaves (opening the maya file in batch mode with mayapy), so I wrote the script below.

Could someone tell me how to reproduce this subprocess command : subprocess.Popen(mayaPath + ’ ’ + scriptPath + ’ ’ + scene) with Deadline “RunProcess” command ?

Thanks !

[code]import os
from System.IO import *
from Deadline.Scripting import *
from Deadline.Plugins import *

def main():
outputDirectories = SlaveUtils.GetCurrentJobValue(“OutputDirectories”)
Name = GetJob()

sceneName = str(Name).replace(" ","").split("-")[0] + ".ma"
scene = str(outputDirectories[0]) + "\\" + str(sceneName)

mayaPath = 'c:/program files/autodesk/maya2013/bin/mayapy.exe'
scriptPath = 'D:\\temp\\createSphere.py'

maya = RunProcess(mayaPath, '"<scriptPath>"'+'"<scene>"',"c:/program files/autodesk/maya2013/bin/", -1)
#maya = subprocess.Popen(mayaPath + ' ' + scriptPath + ' ' + scene)[/code]

Hello,

I am going to need to sit down with some of our coders and see how that can be done. Just to verify, it’s only Maya jobs you need this done for, right? Thanks.

Not much has changed in the SpawnProcess/RunProcess functionality between v5 and v6, so the online v5 docs are pretty much still correct for this exact function:

thinkboxsoftware.com/deadlin … _Utilities

With this function the various “args” are all overrides, so hence, there are various options on how many you include, if you want to additionally control the window style or working directory or redirect the STDout. The minimum requirement is just to define the executable. You would then use the “WaitForExit” function if you wanted to make it a blocking call. So, define the “Process” object and then execute it via the “ProcessUtils.WaitForExit” function.

[code]from Deadline.Scripting import *

process = ProcessUtils.SpawnProcess( string executable, string arguments, string workingDirectory, ProcessWindowStyle windowStyle )
ProcessUtils.WaitForExit( process, -1 )[/code]