Start a python interactive shell from python.

Fernando Perez at
Thu Jan 26 13:46:58 EST 2006

Bo Peng wrote:

> I think I find what I need:

That's a nice, lightweight one.  Note that if you want to have all the bells
and whistles of ipython (and you have ipython already), then a simple

if __name__ == '__namin__':
    from IPython.Shell import IPShellEmbed
    ipshell = IPShellEmbed()
    ipshell() # this call anywhere in your program will start IPython 

will do.  You'll find all the details on how to customize ipython for this kind
of task here:

Given ipython's threading capabilities, you can even instantiate this with
proper thread support in case you want to be able to use matplotlib (or any
other GUI toolkit) interactively. Neither the ASPN recipe, nor anything in the
stdlib, will give you this.

Feel free to stop by the ipython-user list if you have more questions: I don't
monitor regularly so I may miss threads or replies here.



More information about the Python-list mailing list