Re: stop script w/o exiting interpreter

2007-01-29 Thread Garrick . Peterson
> I want, and the script will stop executing at that line and will > return to the interactive interpreter, as I wish. May I recommend wrapping your main program in a function definition? Such as: main(): # Bulk of your code (use a macro to indent it faster) if __name__ == "__main__":

Re: stop script w/o exiting interpreter

2007-01-27 Thread Gabriel Genellina
"Alan Isaac" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > Please note that this post has subject > "stop script w/o exiting interpreter". > Note that I can just put the undefined name ``stop`` on any line > I want, and the script will

Re: stop script w/o exiting interpreter

2007-01-27 Thread Alan Isaac
Please note that this post has subject "stop script w/o exiting interpreter". The object is to work at the *interactive* interpreter, without leaving it. Here is an example goal: start a Python shell, execfile a script, exit the script at line 25, and return to the Python shell.

Re: stop script w/o exiting interpreter

2007-01-26 Thread Colin J. Williams
Alan Isaac wrote: > I'm fairly new to Python and I've lately been running a script at > the interpreter while working on it. Sometimes I only want to > run the first quarter or half etc. What is the "good" way to do this? > > Possible ugly hacks include: > > - stick an undefined name at the des

Re: stop script w/o exiting interpreter

2007-01-26 Thread Bruno Desthuilliers
Alan Isaac a écrit : > I'm fairly new to Python and I've lately been running a script at > the interpreter while working on it. Sometimes I only want to > run the first quarter or half etc. What is the "good" way to do this? If the point is to debug your script, then import pdb; pdb.set_trace()

Re: stop script w/o exiting interpreter

2007-01-25 Thread Miki
Hello Alan, > I'm fairly new to Python and I've lately been running a script at > the interpreter while working on it. Sometimes I only want to > run the first quarter or half etc. What is the "good" way to do this? If you want to exit from the program then "raise SystemExit" is what you want. I

Re: stop script w/o exiting interpreter

2007-01-25 Thread Paul Rubin
"Alan Isaac" <[EMAIL PROTECTED]> writes: > I'm fairly new to Python and I've lately been running a script at > the interpreter while working on it. Sometimes I only want to > run the first quarter or half etc. What is the "good" way to do this? If it's single threaded then just call sys.exit().

stop script w/o exiting interpreter

2007-01-25 Thread Alan Isaac
I'm fairly new to Python and I've lately been running a script at the interpreter while working on it. Sometimes I only want to run the first quarter or half etc. What is the "good" way to do this? Possible ugly hacks include: - stick an undefined name at the desired stop point - comment out th