spawnprocess question

Hi,

in my postjobscript I have a ProcessUtils.SpawnProcess that runs an executable with arguments. Can I redirect it’s output to a textfile somehow (on windows)? Like with a “>” in commandline?

Thanks,
Gabor

I just tested that here, and it doesn’t seem to work. What if you wrapped your command in a batch file that redirected to stdout, and then just ran the batch file with SpawnProcess?

Hi Ryan,

:slight_smile: exactly that was how it worked before. I run a .bat that outputs to a textfile. But that’s what I want to avoid now, to have that extra batchfile, hardcoded the application path. Now I get that from deadline with GetConfigEntry, and then SearchFileList) and simply run the executable I got: much cleaner and better like this, I just missing that output log for debugging.
Subprocess.popen will not work here I assume…?

Thanks,
Gabor

What if you created a temporary batch file from your code and then ran it? That way, you could populate it with the executable path at runtime.

Another option would be to use an environment variable in the batch file (ie: %MYRENDERPATH%), and then prior to running the script, the post job script could just set that environment variable using Environment.SetEnvironmentVariable:
msdn.microsoft.com/en-us/library … iable.aspx

You should be able to use Subprocess.popen, but you would have to make your script a Python.NET script (which requires Deadline 5.1). To make a script a Python.NET script, you just need to add this to the top of the script:

#Python.NET

Cheers,

  • Ryan

Hi Ryan,

thanks for the quick feedback! I will try them out, the first seems to be the easiest.

Thanks,
Gabor