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 modules. If you have a file there that has the same name as a standard library module, e.g. token.py, it will be found first and, thus, "hide" the standard library module of the same name. Either change the name of your file so it does not conflict or make sure it is in a directory not on sys.path.
---------- nosy: +ned.deily resolution: -> not a bug stage: -> resolved status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21924> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com