stop program and start interactive interpreter

D

Dave Reed

I seem to remeber reading somewhere there was a statement you could
put in your python program to stop its execution and start the
interactive interpreter at that point (and then you could change the
value of some variables and continue executing). Am I having delusions
or is there a way to do this?

Thanks,
Dave
 
J

John J. Lee

Dave Reed said:
I seem to remeber reading somewhere there was a statement you could
put in your python program to stop its execution and start the
interactive interpreter at that point (and then you could change the
value of some variables and continue executing). Am I having delusions
or is there a way to do this?

I think you're right, but don't recall how you do it.

python -i spam.py

might be good enough for you, though


John
 
D

Dave Kuhlman

Dave said:
I seem to remeber reading somewhere there was a statement you
could put in your python program to stop its execution and start
the interactive interpreter at that point (and then you could
change the value of some variables and continue executing). Am I
having delusions or is there a way to do this?

Thanks,
Dave

Take a look at IPython. It provides both an enhanced Python
command line and an interactive shell that you can call from within
your Python source code. However, I believe that if you change the
value of variables, those new values are lost when you exit the
IPython shell and continue execution.

http://ipython.scipy.org/

The manual is at:

http://ipython.scipy.org/doc/manual/index.html

And the part of the manual about the interactive shell is at:

http://ipython.scipy.org/doc/manual/node9.html

Hope this helps.

(another) Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top