Skip to content
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

Not working with ipython #3

Closed
pablogsal opened this issue Sep 22, 2015 · 1 comment
Closed

Not working with ipython #3

pablogsal opened this issue Sep 22, 2015 · 1 comment

Comments

@pablogsal
Copy link

The following piece of code

import tracestack
tracestack.on()
1 / 0

does work on the standard python interpreter (2.7.10) but no in ipython (4.0.0). The exit in ipython is obviously:

In [1]: import tracestack

In [2]: tracestack.on()

In [3]: 1 / 0
---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)
<ipython-input-3-b710d87c980c> in <module>()
----> 1 1 / 0

ZeroDivisionError: integer division or modulo by zero

and nothing happens.

Some ideas?

@danrobinson
Copy link
Owner

Thanks. It looks like IPython doesn't use sys.excepthook.

I think we'll have to test for IPython and, if the user is using it, override the showsyntaxerror and showtraceback methods of IPython.core.interactiveshell.InteractiveShell to have them invoke the custom handler.

Conveniently, this is precisely what we do for python's interactive interpreter in console.py; inconveniently code.InteractiveInterpreter is an old-style class in Python 2.7 so multiple inheritance may not be possible. I'll take a look and try to patch tonight or tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants