os.system vs subprocess
walton.nathaniel at gmail.com
Sun Jun 21 13:12:03 EDT 2009
I get different behavior with os.system and subprocess (no surprise
there I guess), but I was hoping for some clarification, namely why.
If I type this directly into the command window:
java -Xms128M -Xmx512M -jar gmapcreator.jar -dfile=censettings.xml >
mapoutput.txt stores the output:
Command line mode: input file=censettings.xml
1358 files will be created in C:\Documents and Settings\Nate\Desktop
1358 tiles created out of 1358 in 16 seconds
If I execute said command with subprocess, the output is not written
to mapoutput.txt - the output just appears in the command window.
If I execute said command with os.system, the output is written to
mapoutput.txt like I expected.
In reality all I want to do is access the first two lines of the above
output before the process finishes, something which I haven't been
able to manage with subprocess so far. I saw that somehow I might be
able to use os.read(), but this is my first attempt at working with
pipes/processes, so I'm a little overwhelmed.
More information about the Python-list