Start the interactive shell within an application

Robert Kern robert.kern at gmail.com
Tue Jun 9 21:27:05 CEST 2009


On 2009-06-09 03:49, Jean-Michel Pichavant wrote:
> I was wondering if there is a way to start an interactive shell within a
> script/application.
> I'm sometimes tired of adding prints to scan the current namespace so
> I'd like to pause the execution and give the user the shell prompt.
> This is obviously for debugging purpose.
>
> I know that I may use the raw_input and eval the captured text but
> honestly, this requires some coding and I won't benefit from the shell
> features. Would it be even possible to use a shell like Ipython ?

http://ipython.scipy.org/doc/stable/html/interactive/reference.html#embedding-ipython

> By the way, if anyone has cunning ways for debugging code to share, he
> would be much welcome.

You would do well to learn to use the standard Python debugger:

   http://docs.python.org/library/pdb

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list