Read/Write from/to a process
jas
codecraig at gmail.com
Tue Oct 25 08:59:45 EDT 2005
Steve Holden wrote:
> Look at how you might do it in other languages. Then you'll realise this
> isn't (just) a Python problem.
Yea your right. However, for example, in Java, one can use the Process
class, and then read from the stream until its the end (i.e. -1 is
returned). However, with Python when reading from
subprocess.Popen.stdout ...I don't know when to stop (except for
looking for a ">" or something). Is there a standard, like read until
"-1" or something?
As I mentioned, os.system("cmd") gives me exactly the
output/interactivity I need...but I can't redirect the output.
Thanks.
More information about the Python-list
mailing list