[Tutor] problem with subprocess

Bala subramanian bala.biophysics at gmail.com
Fri Jul 30 14:36:41 CEST 2010


Dear Friends,

I have to do a series of job in a remote machine. I put each job in a text
file called 'job' as and wrote the following code that can read each line in
the text file and execute the job.

I login to the machine and run the script as 'python job.py'. But when i
logout from the machine, the job gets killed. So i submitted the job in
background as 'python job.py &'. Even in this case, when i logout from the
machine, the job gets killed. Why is this so. How can i avoid the same ?

#!/usr/bin/env python
from sys import argv
import subprocess
for line in open('job'):
    subprocess.call(line,shell=True)

Thanks,
Bala
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100730/809b2814/attachment.html>


More information about the Tutor mailing list