[IPython-dev] [patch] IPython.set_trace() implemented

Gökhan SEVER gokhansever at gmail.com
Tue Jun 23 12:16:06 EDT 2009


 Note: Cross-posting on IPy devel and Matplotlib-users list.

Hello,

My 8 hours sleep have helped me solve the riddle of IPython pylab entry from
a regular Python script. Although it is funky and experimental, it works
just as I have been seeking it to work for months :)

Here take a look at this piece of code:

(Again, the following lines must be modified in /IPython/Shell.py to start
with pylab each time a request is made for IPython instantiation. To me a
line can be added into ipy_user_config such as always_pylab =True )

     #user_opts = set([s.replace('-','') for s in argv[:3]])     user_opts =
set(['pylab'])


#!/usr/bin/env python

#import matplotlib.pyplot as plt
#import numpy as np
import IPython

ipy = IPython.Shell.start(user_ns=locals())

a = arange(10)           ###<-- I am in IPython -pylab at this point no need
for np.arange
plot(a)                        ###<-- or plt.plot(a)

ipy.mainloop()

Later, when I drop into the IPy shell I can go ahead and manipulate my
figure appropriately. Now whos() works also :)


Gökhan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20090623/c266f5ad/attachment.html>


More information about the IPython-dev mailing list