nohup and os.system

Gideon gideon.simpson at gmail.com
Thu Mar 12 00:05:59 EDT 2009


I've got a python script, batch.py that, amongst other things,
executes commands:

os.system('cmd1')
os.system('cmd2')

now, these programs output certain information at the command line,
and if i execute

./batch.py

it shows up as I would expect.

However, if i run

nohup ./batch.py &

then while everything runs, but the intermediate output that generated
by each os.system call does not get appended to nohup.out until
*after* the command finishes executing.  Is there a way I can get this
data to be appended in real time?

What I'm doing in practice is sticking a lightweight python script
around an existing fortran binary, and I'd like to be able to monitor
the progress of the binary be checking the nohup.out log.



More information about the Python-list mailing list