[New-bugs-announce] [issue21924] Cannot import anything that imports tokenize from script called token.py

Peter Inglesby report at bugs.python.org
Sun Jul 6 02:30:33 CEST 2014


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 1, in <module>
    import tokenize
  File "/usr/local/Cellar/python3/3.4.0/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tokenize.py", line 38, in <module>
    __all__ = token.__all__ + ["COMMENT", "tokenize", "detect_encoding",
AttributeError: 'module' object has no attribute '__all__'

----------
messages: 222386
nosy: inglesp
priority: normal
severity: normal
status: open
title: Cannot import anything that imports tokenize from script called token.py
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21924>
_______________________________________


More information about the New-bugs-announce mailing list