subprocess seems to "detach" / ignore wait()
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Thu Aug 21 03:26:07 EDT 2008
En Thu, 21 Aug 2008 02:46:06 -0300, Mathieu Prevot <mathieu.prevot at ens.fr> escribió:
>> So what is the right thing to do so my script
>> returns 1 or 0 depending on its state and success ?
I use something like this:
def main(argv):
try:
try:
do_things()
return 0
finally:
do_cleanup()
except:
log_exception()
return 1
if __name__=='__main__':
import sys
sys.exit(main(sys.argv))
> PS: BTW how can I detach my process ie have an equivalent to
> `myscript.py&` from the python script ?
There are a few recipes in the Python CookBook at http://code.activestate.com/recipes/langs/python/
--
Gabriel Genellina
More information about the Python-list
mailing list