[IPython-user] "Internal Python error in the inspect module" when a zipped egg raises an exception
Jouni K. Seppänen
jks@iki...
Fri May 11 23:54:58 CDT 2007
I installed simplejson using easy_install, and then tried to test it.
Here's what happens when you give it malformed input (full transcript
at end of message):
> In [1]: import simplejson
>
> In [2]: simplejson.loads('')
> ERROR: Internal Python error in the inspect module.
> Below is the traceback from this internal error.
>
> Traceback (most recent call last):
[...]
> Unfortunately, your original traceback can not be constructed.
The simplejson library is working fine, but the traceback confuses
ipython, apparently because the code for simplejson is in an egg file.
When I forced easy_install to install the egg unzipped, things started
working fine:
> In [2]: simplejson.loads('')
> ---------------------------------------------------------------------------
> exceptions.ValueError Traceback (most recent call last)
>
> /Users/jks/<ipython console>
[...]
> ValueError: No JSON object could be decoded
Is there anything the inspect module could do to avoid this problem?
Probably it cannot work all its magic when the code is hidden in an
egg file, but could it detect the situation and just show the original
traceback instead of attempting anything clever?
Here's a complete transcript, showing version info and the exact
traceback from the inspect module:
Python 2.4.4 (#1, Oct 18 2006, 10:34:39)
Type "copyright", "credits" or "license" for more information.
IPython 0.8.1 -- An enhanced Interactive Python.
? -> Introduction to IPython's features.
%magic -> Information about IPython's 'magic' % functions.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
In [1]: import simplejson
In [2]: simplejson.loads('')
ERROR: Internal Python error in the inspect module.
Below is the traceback from this internal error.
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/ipython-0.8.1-py2.4.egg/IPython/ultraTB.py", line 491, in text
records = _fixed_getinnerframes(etb, context,self.tb_offset)
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/ipython-0.8.1-py2.4.egg/IPython/ultraTB.py", line 124, in _fixed_getinnerframes
records = inspect.getinnerframes(etb, context)
File "/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/inspect.py", line 804, in getinnerframes
framelist.append((tb.tb_frame,) + getframeinfo(tb, context))
File "/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/inspect.py", line 768, in getframeinfo
lines, lnum = findsource(frame)
File "/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/inspect.py", line 437, in findsource
if pat.match(lines[lnum]): break
IndexError: list index out of range
Unfortunately, your original traceback can not be constructed.
In [3]: simplejson.loads('{}')
Out[3]: {}
--
Jouni K. Seppänen
http://www.iki.fi/jks
More information about the IPython-user
mailing list