[IPython-User] Invoking ipython shell in the middle of script run and using magic commands

MinRK benjaminrk@gmail....
Sun Apr 8 14:09:03 CDT 2012


That's precisely what IPython.embed() is for.  What doesn't it do that you
want it to?

-MinRK

On Sun, Apr 8, 2012 at 12:03, Joon Ro <joonpyro@gmail.com> wrote:

> Hi,
>
> Basically what I want to do is stop the script during its run and invoke
> ipython shell,
> just like setting from ipdb import set_trace; set_trace().
>
> But also I want to use some magic commands, especially %timeit, in the
> shell, so I can
> check how a couple of different implementation of a function performs. I
> want to do it
> in the middle of a script run because there is a lot of overhead and I
> don't want to
> make another script just for the testing.
>
> I found putting the following into the code pretty much did what I want:
>
>  from IPython import embed
> embed()
>
> as this gives all the variables with their values and also I could use
> magic commands as well.
> I wonder if there is better way to do this or this is the right way?
>
> Thank you,
> Joon
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20120408/6e5d2f01/attachment.html 


More information about the IPython-User mailing list