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

Ondrej Certik ondrej at certik.cz
Tue Jun 23 02:17:14 EDT 2009


On Mon, Jun 22, 2009 at 11:58 PM, Gökhan SEVER<gokhansever at gmail.com> wrote:
>> 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.
>
> Check out this:
>
>
> [gsever at ccn python-repo]$ python
> Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38)
> [GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import IPython
>>>> IPython.set_trace()
>  Logging to /home/gsever/.ipython/2009-06-23.py
>
> Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38)
> Type "copyright", "credits" or "license" for more information.
>
> IPython 0.10.bzr.r1174 -- 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]: exit()
> Do you really want to exit ([y]/n)? y
>>>> arr = arange(10)
> ---------------------------------------------------------------------------
> NameError                                     Python 2.5.2: /usr/bin/python
>                                                    Tue Jun 23 00:54:55 2009
> A problem occured executing Python code.  Here is the sequence of function
> calls leading up to the error, with the most recent (innermost) call last.
>
> /home/gsever/Desktop/python-repo/ipython/IPython/FakeModule.pyc in
> <module>()
> ----> 1
>       2
>       3
>       4
>       5
>       6
>       7
>       8
>       9
>      10
>      11
>      12
>      13
>      14
>      15
>      16
>      17
>      18
>      19
>      20
>      21
>      22
>      23
>      24
>      25
>      26
>      27
>      28
>      29
>      30
>      31
>
> NameError: name 'arange' is not defined
>
> **********************************************************************
>
> Oops, IPython crashed. We do our best to make it stable, but...
>
> A crash report was automatically generated with the following information:
>   - A verbatim copy of the crash traceback.
>   - A copy of your input history during this session.
>   - Data on your current IPython configuration.
>
> It was left in the file named:
>     '/home/gsever/.ipython/IPython_crash_report.txt'
> If you can email this file to the developers, the information in it will
> help
> them in understanding and correcting the problem.
>
> You can mail it to: Ville Vainio at vivainio at gmail.com
> with the subject 'IPython Crash Report'.
>
> If you want to do it now, the following command will work (under Unix):
> mail -s 'IPython Crash Report' vivainio at gmail.com <
> /home/gsever/.ipython/IPython_crash_report.txt
>
> To ensure accurate tracking of this issue, please file a report about it at:
> https://bugs.launchpad.net/ipython/+filebug
>
> Press enter to exit:
>
>
> This error message tells me that somewhere in the background Ipython is
> still active, can't completely kill its instance after exiting the session.


Great catch! You are absolutely right, ipython seems to be still
active. Yes, so this approach has it's limitations, that it will alter
the environment.

Never the less, it actually doesn't hurt me at all, because I use
set_trace() to debug some particular part of the code and once I am
done, I don't care if the program crashes or what, since I want to
exit it anyway.

So this should be mentioned in the docstring too. I'll wait for
ipython developers if they agree with the patch and if so, I'll update
the docstring with this information.

Ondrej



More information about the IPython-dev mailing list