import inspect error

Chris Angelico rosuav at gmail.com
Mon Sep 17 05:00:37 EDT 2018


On Mon, Sep 17, 2018 at 6:06 PM, nobody <jupiter.hce at gmail.com> wrote:
> I have following errors running on Ubuntu 18, any insight how to fix it? Thank you.
>
> Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34)
> [GCC 7.3.0] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import inspect
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/lib/python2.7/inspect.py", line 42, in <module>
>     from collections import namedtuple
>   File "/usr/lib/python2.7/collections.py", line 22, in <module>
>     from keyword import iskeyword as _iskeyword
>   File "keyword.py", line 3, in <module>
>     from inspect import currentframe, getframeinfo
> ImportError: cannot import name currentframe

You've made a file called keyword.py, which is shadowing the standard
library module of that name. Rename or delete that file, and you
should be able to use the original again.

ChrisA



More information about the Python-list mailing list