You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The minimum example that reliably recreates this problem on windows python 2.7 (master ffc36cc):
Create an empty profile and add the following code to a py file in the startup folder for the new profile:
import inspect
inspect.stack()
Now start ipython and generate an exception:
IPython 0.14.dev -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
IPython profile: empty
In [1]: 1/0
ERROR: Internal Python error in the inspect module.
Below is the traceback from this internal error.
Traceback (most recent call last):
File "C:\python27\lib\site-packages\ipython-0.14.dev-py2.7.egg\IPython\core\ultratb.py", line 749, in structured_traceback
records = _fixed_getinnerframes(etb, context, tb_offset)
File "C:\python27\lib\site-packages\ipython-0.14.dev-py2.7.egg\IPython\core\ultratb.py", line 235, in _fixed_getinnerframes
records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
File "C:\python27\lib\inspect.py", line 1041, in getinnerframes
framelist.append((tb.tb_frame,) + getframeinfo(tb, context))
File "C:\python27\lib\inspect.py", line 1001, in getframeinfo
filename = getsourcefile(frame) or getfile(frame)
File "C:\python27\lib\inspect.py", line 456, in getsourcefile
if hasattr(getmodule(object, filename), '__loader__'):
File "C:\python27\lib\inspect.py", line 499, in getmodule
f = getabsfile(module)
File "C:\python27\lib\inspect.py", line 468, in getabsfile
_filename = getsourcefile(object) or getfile(object)
File "C:\python27\lib\inspect.py", line 447, in getsourcefile
if string.lower(filename[-4:]) in ('.pyc', '.pyo'):
TypeError: 'NoneType' object is not subscriptable
Unfortunately, your original traceback can not be constructed.
The second time we try to generate the traceback:
In [2]: 1/0
---------------------------------------------------------------------------
ZeroDivisionError Traceback (most recent call last)
<ipython-input-2-05c9758a9c21> in <module>()
----> 1 1/0
ZeroDivisionError: integer division or modulo by zero
As far as I have been able to determine the traceback is caused by __main__.__file__ being None at startup in the terminal console but not in any of the other terminals. %run:ing some code also sets __main__.__file__ to a reasonable value.
In [1]: %run pass.py
In [2]: 1/0
---------------------------------------------------------------------------
ZeroDivisionError Traceback (most recent call last)
<ipython-input-2-05c9758a9c21> in <module>()
----> 1 1/0
ZeroDivisionError: integer division or modulo by zero
Setting a break point in inspect.getsourcefile:
In [1]: 1/0
> c:\python27\lib\inspect.py(449)getsourcefile()
-> if string.lower(filename[-4:]) in ('.pyc', '.pyo'):
(Pdb) list 446
441
442 def getsourcefile(object):
443 """Return the filename that can be used to locate an object's source.
444 Return None if no way can be identified to get the source.
445 """
446 filename = getfile(object)
447 if filename is None:
448 import pdb;pdb.set_trace()
449 -> if string.lower(filename[-4:]) in ('.pyc', '.pyo'):
450 filename = filename[:-4] + '.py'
451 for suffix, mode, kind in imp.get_suffixes():
(Pdb) object.__file__
(Pdb) object
<module '__main__' (built-in)>
The text was updated successfully, but these errors were encountered:
The minimum example that reliably recreates this problem on windows python 2.7 (master ffc36cc):
Create an empty profile and add the following code to a py file in the startup folder for the new profile:
Now start ipython and generate an exception:
The second time we try to generate the traceback:
As far as I have been able to determine the traceback is caused by
__main__.__file__
being None at startup in the terminal console but not in any of the other terminals. %run:ing some code also sets__main__.__file__
to a reasonable value.Setting a break point in inspect.getsourcefile:
The text was updated successfully, but these errors were encountered: