I thought sys.path was a complete list of all the search paths for Python modules.
However, on my Ubuntu machine '/usr/local/lib/python2.6/dist-packages/' there are almost all of my modules and this path is not in sys.path. And I can import any module along the way.
EDIT, NOT TRUE: even if I set sys.path to an empty list, I can still import from this path.
Where does this implicit knowledge of the dist-packages path come from? Are there other paths in this implicit search path group or something else?
EDIT: It seems that the second part of my post is not true. Indeed, "sys.path = []" means that I cannot import anything, even from my current working directory. My apologies.
source
share