Python Forum

Full Version: module inspect error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I am running python on Ubuntu 18, I have following errors when I run import inspect, appreciate any tips to fix the problem. thank you

Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34)
[GCC 7.3.0] on linux2

>>> 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
Do you possibly have your own file named keyword.py which is masking the real one the module is trying to import?