G:\code\Python\hello\helloworld.py
G:\code\Python\hello\mymodule\gettime.py
G:\code\Python\hello\mypath.pth
I write gettime.py
in mymodule
, I'd import gettime
in helloworld
. I write "G:\\code\\Python\\hello\\mymodule"
in mypath.pth
.
Can I put mypath.pth
in the directory "G:\code\Python\hello"
?
No, it won't work, per the
site
documentation:The four directories mentioned "above" are specific to the Python install, they're not related to the working directory. It's actually more than four (they're not including the optional user site-packages directory for instance), but the list is not arbitrarily long, and the working directory is never involved in determining what
.pth
files to use.