Thanks Fredrik, yeah the while loop for single run is pretty stupid.

sys.exit() thats the call I was looking for.

-Josh

On 11/14/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
Josh Bloom wrote:

> Hi everyone, I'm looking for a way to stop execution of a script from
> within the script.
>
> I'm familiar with this idiom:
>
> While 1:
>   doFirstThing()
>   doSecondThing()
>   if something:
>     break
>   doThirdThing()
>   break

I'm not.  why are you using a while statement to execute the code once?

> doFirstThing()
> doSecondThing()
> if something:
>     die
> doThirdThing()

sys.exit() ?

(or if you prefer, "raise SystemExit")

</F>

--
http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to