Hello, I've written a script which conducts several subprocess calls and then ultimately calls a shell script which runs even more programs... my script is using subprocess to execute a few sed calls, and then execute the script. I'm getting strange behavior:
Here's a snippet of my script (any general comments are also welcome): if RUNS[k][3]==1: #model run complete, run is a DICT compWebPages=self.getCompletedWeb() #returns a DICT, which RUNS[k][0] COULD be a key if RUNS[k][0] not in compWebPages.keys(): runFile='make_'+RUNS[k][0] cmd = """sed -e 's/RUNmin=[0-9][0-9]*/RUNmin=%s/g' %s > jnk""" % (k,'make_wwwpages'); subprocess.call(cmd,shell=True) cmd = """cat jnk | sed -e 's/RUNmax=[0-9][0-9]*/RUNmax=%s/g' > %s""" % (k,runFile); subprocess.call(cmd,shell=True); subprocess.call('rm jnk',shell=True); os.chmod(runFile,0744) cmd="""./%s""" % (runFile) print "Starting %s" % (runFile) #subprocess.call(cmd,shell=True) q=raw_input('continue?'); print "Done with: %s" % (RUNS[k][0]) cmd="""rm %s""" % (runFile); subprocess.call(cmd,shell=True) You'll notice, the last subprocess call is commented out. Right now I'm just getting to that point to make sure everything is working. So, it seems to work, but I'm not sure how to get it to work if I change the command to nohup. I still want python to wait for it to return, in fact, I would like to set the python job running in the background as well... so what I'm looking at doing is: % nohup myControl.py ---> which will make several subprocess.call(s) including some that should be 'nohupped' as well... Suggestions on the syntax of how to do this? Thanks! -- Configuration `````````````````````````` Plone 2.5.3-final, CMF-1.6.4, Zope (Zope 2.9.7-final, python 2.4.4, linux2), Five 1.4.1, Python 2.4.4 (#1, Jul 3 2007, 22:58:17) [GCC 4.1.1 20070105 (Red Hat 4.1.1-51)], PIL 1.1.6
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor