Thanks for the super fast responses guys, amazing. Jeff, thanks, i had tried the popen, but was never able to get the syntax to make it work properly. just too much of a n00b. thanks though.
Bruce, the .NET calls worked perfectly. my next step was going to be to try to build a dll to make it work, but this is so much easier. Thanks for the super help guys. Dragged me out of the fire. -b On Thu, Jan 20, 2011 at 7:11 AM, Bruce Bromberek <bruce.brombe...@gmail.com>wrote: > 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 > proc.Start() > proc.WaitForExit() > print "Done" > > > 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)[0] > > > 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 > > import clr > clr.AddReference('StdLib') > import subprocess > ... > > > > 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 > import clr > clr.AddReference('mscorlib') > from System import IO > from System.IO.Path import Combine > > def walk(folder): > for file in IO.Directory.GetFiles(folder): > yield file > for folder in IO.Directory.GetDirectories(folder): > for file in walk(folder): > yield file > > folder = IO.Path.GetDirectoryName(__file__) > print folder > > myfiles = list(walk(IO.Path.Combine(folder, 'STDLIB'))) > > > clr.CompileModules(Combine(folder,".\StdLib.dll"), *myfiles) > > > 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 > 2011 > > for x64/bin/vrimg2exr.exe", inFile, outFile],stdout=subprocess.PIPE) > > print converter.communicate()[0] > > > > _______________________________________________ > Users mailing list > Users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > >
_______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com