2008/8/21 Gabriel Genellina <[EMAIL PROTECTED]>: > En Thu, 21 Aug 2008 02:46:06 -0300, Mathieu Prevot <[EMAIL PROTECTED]> > 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/
The return from main()... it was my thought too. Thank you Gabriel :) Mathieu -- http://mail.python.org/mailman/listinfo/python-list