Closed gvwilson closed 4 years ago
One more thought on a configuration topic that we might want to consider... at the moment we import utilities
(the module we wrote) in countwords.py
. That works fine if we run countwords.py
from the zipf/bin
directory (or a directory higher up the tree) but won't work if we execute from zipf/results
or some other random directory on our system. Do we need to talk about sys.path
and how we tell Python where to look for our modules?
(Or maybe it's best mentioned in Chapter 4 when we first introduce modules...?)
The import works on my machine: in general, import x
will always find an x.py
that's in the same directory as the file doing the import, even if that directory is not on PYTHON_PATH
.
Ready for review.