[Tutor] feeding data to subprocess exes and getting results without writing files
David.Barton at nottingham.ac.uk
Tue Jan 9 14:34:53 CET 2007
I can easily use the subprocess module to run a separate exe from within
process=subprocess.Popen("myprog.exe -i inputfile.txt -o
..and that's just fine as far as it goes, if I don't mind creating
'inputfile.txt' first, and reading 'outputfile.txt' afterward.
But what if I do mind? I'm trying to do something like..
stdin="my input string"
process=subprocess.Popen("myprog.exe -i stdin -o stdout") # (infact
these are the default args for -i and -o, so it seems like myprog.exe
can be used this way)
I just can't wrap my head around stdin, stdout and the whole pipes
thing, but there's got to be a relatively simple way to do this, surely?
thanks for any help,
Dave (relative newbie using PythonWin & Python 2.4)
This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor