Package organization: where to put 'common' modules?

fortepianissimo fortepianissimo at gmail.com
Sun Mar 5 18:02:56 EST 2006


Hm this doesn't work. Say I have the following directory structure:

A
|--- util
|    |--- foo.py
|
|--- B
     |--- bar.py


And bar.py has this line

from util import foo


I then run

python B/bar.py

in directory A. Still got error

ImportError: No module named util


A check of sys.path in bar.py when running from A revealed that
sys.path has A/B, not A.

Am I missing something here?




More information about the Python-list mailing list