[Tutor] Making Python Find Modules

D-Man dsh8290@rit.edu
Sun, 18 Mar 2001 14:08:28 -0500


On Sun, Mar 18, 2001 at 05:15:49AM -0800, Daniel Yoo wrote:
| On Sat, 17 Mar 2001, Britt Green wrote:
| 
| One other thing you might need besides PYTHONPATH, if you have
| subdirectories in your Code directory, is an '__init__.py' file.  Let's
| say that we have the following directory structure:
| 
| 
|     /Code/
| 
|          Math/
|          SecretPlans/
| 
| Even if we add Code to your PYTHONPATH, Python will not automatically look
| at directories within Code; I'm not quite sure why, but that's the default

I think it is related to packages vs. modules.  A directory containing
__init__.py is a package.  I'm not to clear on the particulars and why
one would want to use a package instead of a module though.

-D