RE: Restarting scripts

2006-01-16 Thread Ron Griswold
ilto:[EMAIL PROTECTED] On Behalf Of Peter Hansen Sent: Monday, January 16, 2006 5:40 PM To: python-list@python.org Subject: Re: Restarting scripts Brian Cole wrote: > If everything dies by a Python exception... > > if __name__ == '__main__': > try: > main(s

Re: Restarting scripts

2006-01-16 Thread Peter Hansen
Brian Cole wrote: > If everything dies by a Python exception... > > if __name__ == '__main__': > try: > main(sys.argv) > except: > os.execlp("python", "python", sys.argv) > > Pretty nasty peice of code, but it works well for restarting your script. Noting that sys.exit()

Re: Restarting scripts

2006-01-16 Thread Brian Cole
> > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Brian Cole > Sent: Monday, January 16, 2006 1:46 PM > To: Ron Griswold > Cc: python-list@python.org > Subject: Re: Restarting scripts > > If everything dies by a Python exc

Re: Restarting scripts

2006-01-16 Thread Brian Cole
If everything dies by a Python exception... if __name__ == '__main__': try: main(sys.argv) except: os.execlp("python", "python", sys.argv) Pretty nasty peice of code, but it works well for restarting your script. -Brian On 1/16/06, Ron Griswold <[EMAIL PROTECTED]> wrote:

Restarting scripts

2006-01-16 Thread Ron Griswold
This may be a little OT, but it does involve python scripts. I’ve written a server that hosts my companies asset management system. Of course something like this cannot be down for very long without data being lost (of course I have taken measures to inform the user of the down time and ask