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
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()
>
>
> -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
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: