New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
debugging with ipython does not work well outside ipython #57
Comments
[ LP comment 1 by: Robert Cimrman, on 2009-08-12 08:40:53.292770+00:00 ] |
[ LP comment 2 by: Fernando Perez, on 2010-04-26 06:07:25.063351+00:00 ] I'm afraid that for now, IPython's debugger is pretty much welded to living inside a 'real ipython'. It simply assumes in too many places that the ipython machinery is already up and running. It would be definitely great to decouple them, but it's a fairly non-trivial job. I'm marking this as a wishlist item so we don't forget about it, but I don't think it will happen soon, unfortunately. |
[ LP comment 3 by: Robert Cimrman, on 2010-04-26 07:43:56.257570+00:00 ] Thanks Fernando. As a workaround, is there a way to capture/silence/redirect to /dev/null somehow the ipython crash report output after pressing Ctrl-C? The crash per se does not matter, it's just the length of the output, that makes the interesting things I saw while debugging to scroll out of sight (and often even the terminal buffer). |
[ LP comment 4 by: Fernando Perez, on 2010-04-27 05:41:20+00:00 ] Hi Robert, On Mon, Apr 26, 2010 at 12:43 AM, Robert Cimrman cimrman3@ntc.zcu.cz wrote:
Certainly, I suspect the problem is that ipython sets sys.excepthook Just save sys.excepthook before you start ipython's machinery to Let me know if that works for you. Cheers, f |
[ LP comment 5 by: Robert Cimrman, on 2010-04-27 11:30:33+00:00 ] On 04/27/10 07:41, Fernando Perez wrote:
Perfect! I will use the following function: def debug():
Do you happen to know how to avoid pressing 'n' to get to the caller's frame? cheers, |
[ LP comment 6 by: Fernando Perez, on 2010-04-27 17:22:46+00:00 ] Hi Robert, On Tue, Apr 27, 2010 at 4:30 AM, Robert Cimrman cimrman3@ntc.zcu.cz wrote:
Great, glad it worked.
No idea, sorry. Cheers, f |
[ LP comment 7 by: Robert Cimrman, on 2010-04-28 08:04:39+00:00 ] On 04/27/10 19:22, Fernando Perez wrote:
I have a working solution now, see below. The only problem is, that sphinx' .. automodule:: my_module
In my_module: def get_debug():
debug = get_debug() cheers, |
[ LP comment 8 by: Fernando Perez, on 2010-04-28 17:42:05.185350+00:00 ] OK, great. This bug stays tagged as wishlist, so we can effectively provide something like what you are doing, with a publicly supported api. |
This has now been fixed, though the api is minimally different: from IPython.core.debugger import Tracer
debug = Tracer()
print 'hello'
debug()
print 'hello again'
1/0 If the above is put in a file, it works as expected. Closing. |
Thanks. I got this error message: ImportError: "No module named Debugger" when using the previous idiom: and the new api you note in #57 (comment) is just what I was looking for. Hopefully this will help other searchers find it quickly. |
Cleanup of format selection Two small cleanups/fixes: Much cleaner way of finding the right converter. This will result in much cleaner diffs when changing the API, adding arguments, etc. It also allows us to extract the known formats automatically. Fixed an assertion which didn't actually check the file extension but an arbitrary occurrence of 'rst'
Original Launchpad bug 412396: https://bugs.launchpad.net/ipython/+bug/412396
Reported by: cimrman3 (Robert Cimrman).
Python 2.5.4, IPython 0.9.1, gentoo linux
The Tracer does not work outside ipython, short summary follows below, for details see the thread [1].
[1] http://mail.scipy.org/pipermail/ipython-user/2009-July/006451.html
When running the attachment file ipython_debug1.py:
The second file ipython_debug2.py performs better - the debugging is actually possible, but any exception after the 'continue' command causes the ipython crash dump:
then type 'c' to continue, and you get the error. I would like to see
just the ZeroDivisionError, not the ipython crash dump that follows.
The text was updated successfully, but these errors were encountered: