[issue41612] python3.8.3/traceback.py:312, AttributeError: 'KeyError' object has no attribute 'tb_frame'

Abael He report at bugs.python.org
Sat Aug 22 01:50:20 EDT 2020


Abael He <abaelhe at icloud.com> added the comment:

This is a bug caused by IPython:

/opt/conda/lib/python3.8/site-packages/IPython/terminal/ptutils.py in get_completions(self, document, complete_event)
    114             except Exception as e:
    115                 from traceback import print_tb
--> 116                 print_tb(e)
    117 
    118     @staticmethod


######################################################################
# Simulation investigation for above KeyError:
In [3]: def fun():
   ...:     try:
   ...:         s = {}
   ...:         k = s['0']
   ...:     except Exception as e:
   ...:         import sys
   ...:         from traceback import print_tb
   ...:         exc_type, exc_value, exc_traceback = sys.exc_info()
   ...:         print_tb(exc_traceback)
   ...: 

In [4]: fun()
  File "<ipython-input-3-d3df30294ed8>", line 4, in fun
    k = s['0']

----------
resolution:  -> third party
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41612>
_______________________________________


More information about the Python-bugs-list mailing list