[IronPython] opening an exe with iron python
bruce.bromberek at gmail.com
Thu Jan 20 16:11:08 CET 2011
If you are committed to Ironpython, then you can use the the .NET calls
from System.Diagnostics import Process
path = r"C:/Program Files/Chaos Group/V-Ray/Maya 2011 for x64/bin"
execfile = "vrimg2exr.exe"
CMDARGS = "%s %s" % (infile,outfile)
command = "%s\\%s"% (path,execfile)
print "starting command"
proc = Process()
proc.StartInfo.FileName = command
proc.StartInfo.Arguments = CMDARGS
or I have used subprocess to send data in a stream and capture the output.
It is possible to do the same thing with System.Diagnostics but I don't
have an example.
import subprocess as S
mycmd = "XSLTools\\msxsl.exe - FixEncodedMessage.xslt -o %s" % Response
output = S.Popen(mycmd,stdin=S.PIPE,shell=True).communicate(xml)
If you problem is that the IronPython engine you are using in Deadline
doesn't have the standard python modules, you could always build the
modules you need into a DLL on another machine, place the DLL out on the
render farm and use
to build the DLL you would can use the pyc.py script that comes with
Ironpython. I typically create a subfolder in my project, copy the Standard
Lib modules I need (and their dependencies) and use this script from the
commandline to generate the DLL.
#Compile Folder into DLL
from System import IO
from System.IO.Path import Combine
for file in IO.Directory.GetFiles(folder):
for folder in IO.Directory.GetDirectories(folder):
for file in walk(folder):
folder = IO.Path.GetDirectoryName(__file__)
myfiles = list(walk(IO.Path.Combine(folder, 'STDLIB')))
> The existing script is works like this (I'm sure this is error loaded and
> obvious n00b script, so any input would be hugely appreciated):
> converter = subprocess.Popen([r"C:/Program Files/Chaos Group/V-Ray/Maya
> for x64/bin/vrimg2exr.exe", inFile, outFile],stdout=subprocess.PIPE)
> print converter.communicate()
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ironpython-users