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
I was developing a programming language using Python, and I had a 'token.py' file. After changing the name of the file, the issue was solved.
I am sure that my 'token.py' caused the error.
Here's the traceback I got:
Traceback (most recent call last):
File "/some/path/main.py", line 2, in <module>from parser import Parser
File "/some/path/parser.py", line 3, in <module>import traceback
File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/traceback.py", line 5, in <module>import linecache
File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/linecache.py", line 11, in <module>import tokenize
File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tokenize.py", line 35, in <module>from token importEXACT_TOKEN_TYPESImportError: cannot import name 'EXACT_TOKEN_TYPES' from 'token' (/some/path/token.py)
Activity
bichanna commentedon Jan 10, 2022
I was developing a programming language using Python, and I had a 'token.py' file. After changing the name of the file, the issue was solved.
I am sure that my 'token.py' caused the error.
kumaraditya303 commentedon Jan 10, 2022
Python has a token module so you should use any other name for your module.
stevendaprano commentedon Jan 10, 2022
Your module token.py "shadowed" the stdlib token.py, and prevented it from being seen until you changed the name.