[issue21924] Cannot import anything that imports tokenize from script called token.py

2014-07-05 Thread Peter Inglesby
New submission from Peter Inglesby: A script called token.py that imports anything that ends up importing tokenize, such as logging, triggers the following error when the script is run: $ cat token.py import tokenize $ python3 token.py Traceback (most recent call last): File token.py, line

[issue21924] Cannot import anything that imports tokenize from script called token.py

2014-07-05 Thread Ned Deily
Ned Deily added the comment: That's because there is also a standard library module named token (https://docs.python.org/3/library/token.html). When you run python, by default the current working directory is inserted at the beginning of sys.path, the list of directories searched for