[IPython-user] "Internal Python error in the inspect module" when a zipped egg raises an exception

Jerry McRae qrs0xyc02@sneakemail....
Sat May 12 11:14:55 CDT 2007


This isn't much help, but I was able to duplicate your problem.  I found it
will work correctly with either the normal Python prompt, or in IPython with
version 1.4 of simplejson, if you have an older version around.

--Jerry
versions tested:

In [9]: import sys

In [10]: from IPython import Release

In [11]: sys.version,Release.version,simplejson.__version__
Out[11]:
('2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)]',
 '0.8.2.svn.r2333',
 '1.7.1')


On 5/11/07, Jouni K. Seppänen jks-at-iki.fi  wrote:
>
> 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
>
> _______________________________________________
> IPython-user mailing list
> IPython-user@scipy.org
> http://lists.ipython.scipy.org/mailman/listinfo/ipython-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ipython.scipy.org/pipermail/ipython-user/attachments/20070512/1614bcce/attachment.html 


More information about the IPython-user mailing list