The documentation for Python 2.7.10 states that
When a module named spam is imported, the interpreter first searches for a built-in module with that name. If not found, it then searches for a file named spam.py in a list of directories given by the variable sys.path
However this happens when I have a file site.py in my CWD:
import site
print(site.__file__)
>>> site.py
So obviously site was not identified as a builtin-module first, but imported from the CWD instead. Any ideas as to what might be wrong there?
siteis not a builtin modulesys) does not have a.pyfile,sitedoes come fromsite.py.site.pyin the CWD or not, it's always imported from'/usr/lib/python2.7/site.pyc'PYTHONPATHset?siteseems to be imported before the CWD is added tosys.path, but thePYTHONPATHenv variable is added earlier if set.