Skip to content

ERROR:root:Internal Python error in the inspect module. #11960

@Paradiseeee

Description

@Paradiseeee

There is a confusing error when running code in ipython cell. This error occurred only in ipython occasionally (not always, even when running the same code). When I test the same code in python cell, it always works.

Check out the details:
by the way, I'm not quiet sure how to reproduce this error. Like I said, it occurred occasionally.

ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.

Traceback (most recent call last):
  File "D:\ProgramFiles\Python37\Lib\site-packages\IPython\core\interactiveshell.py", line 3326, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-4-c6b5d3049cf8>", line 1, in <module>
    colors = [plt.cm.tab10(i/float(len(cats)-1)) for i in range(len(cats))]
  File "<ipython-input-4-c6b5d3049cf8>", line 1, in <listcomp>
    colors = [plt.cm.tab10(i/float(len(cats)-1)) for i in range(len(cats))]
AttributeError: module 'matplotlib.cm' has no attribute 'tab10'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\ProgramFiles\Python37\Lib\site-packages\IPython\core\interactiveshell.py", line 2040, in showtraceback
    stb = value._render_traceback_()
AttributeError: 'AttributeError' object has no attribute '_render_traceback_'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\ProgramFiles\Python37\Lib\site-packages\IPython\core\ultratb.py", line 1101, in get_records
    return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset)
  File "D:\ProgramFiles\Python37\Lib\site-packages\IPython\core\ultratb.py", line 319, in wrapped
    return f(*args, **kwargs)
  File "D:\ProgramFiles\Python37\Lib\site-packages\IPython\core\ultratb.py", line 353, in _fixed_getinnerframes
    records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
  File "d:\programfiles\python37\lib\inspect.py", line 1502, in getinnerframes
    frameinfo = (tb.tb_frame,) + getframeinfo(tb, context)
  File "d:\programfiles\python37\lib\inspect.py", line 1460, in getframeinfo
    filename = getsourcefile(frame) or getfile(frame)
  File "d:\programfiles\python37\lib\inspect.py", line 696, in getsourcefile
    if getattr(getmodule(object, filename), '__loader__', None) is not None:
  File "d:\programfiles\python37\lib\inspect.py", line 742, in getmodule
    os.path.realpath(f)] = module.__name__
AttributeError: module has no attribute '__name__'
---------------------------------------------------------------------------

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions