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

Ondrej Certik ondrej@certik...
Tue Jun 23 00:52:06 CDT 2009


On Mon, Jun 22, 2009 at 11:32 PM, Gökhan SEVER<gokhansever@gmail.com> wrote:
>> I don't exactly understand what is wrong with your session? It seems
>> to me it does exactly what I want --- it starts an ipython session
>> inplace and allows you to easily manipulate your namespace. As to
>> exiting, this works for me flawlessly:
>>
>> $ python
>> >>> a = 43
>> >>> import IPython
>> >>> IPython.set_trace()
>> Python 2.6.2 (release26-maint, Apr 19 2009, 01:58:18)
>> Type "copyright", "credits" or "license" for more information.
>>
>> IPython 0.10.bzr.r1163 -- An enhanced Interactive Python.
>> ?         -> Introduction and overview of IPython's features.
>> %quickref -> Quick reference.
>> help      -> Python's own help system.
>> object?   -> Details about 'object'. ?object also works, ?? prints more.
>>
>> In [1]: a
>> Out[1]: 43
>>
>> In [2]:
>> >>>
>
> Could you do a whos when you are in the IPython? It says to me the
> interactive namespace is empty, which is not right in this case. Later, when

Right, it's empty in my case too. But otherwise things work.

> you are out of the IP try up arrow keys, whether you are moving through your
> existing IPython shell or Python. Mine acts as if I were still in IPython...


Right, the up/down arrows cycle through the commands that were in
ipython. It seems that ipython somehow rewrote the python's history.
But you are *not* running in ipython after exiting it.

>
>>
>> Which python version and which system are you using? I am on ubuntu
>> jaunty, the latest ipython and the default python2.6.
>
> Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38)
> IPython 0.10.bzr.r1174 (pulled latest trunk just a few days ago)
> Linux ccn 2.6.27.19-170.2.35.fc10.i686.PAE (Fedora 10)
>
>
>>
>> >
>> > Other than these complaints, a very nice addition indeed :)
>>
>> Thanks. :)
>>
>> >
>> > Could you please tell whether IPython instantiation could be expanded to
>> > a
>> > pylab enabled session? (A previously asked question, but just
>> > wondering...)
>>
>> Right --- I don't know. As I said, try to see how the --pylab command
>> is passed to ipython and then trigger it in the code.
>
> Still trying to figure this out. I wish I knew how to easily debug python
> scripts. Is there a way to setup on a specific line? I am so used to use
> this method while coding for small microprocessors. There should definetely
> be more advanced feature for Python.

You can use "pdb", or winpdb. There are lots of other options too, see
this thread on the sage-devel:

http://groups.google.com/group/sage-devel/browse_thread/thread/d7fbcf164eaedbc5

Ondrej


More information about the IPython-dev mailing list