Correctness: sys.path.append("..")
Mark McEahern
marklists at mceahern.com
Tue Jan 8 17:20:13 EST 2002
Jeremy Bowers
> I've taken to sticking this on top of my files in the subdirectories:
>
> import sys
> if ".." not in sys.path:
> sys.path.append("..")
Suppose you have the following structure:
/myproj/biz/customer.py
/myproj/presentation/layout.py
/myproj/data/tabular.py
and you have a module in myproj that needs to use modules in biz,
presentation, and data:
from myproj.biz import customer
from myproj.presentation import layout
from myproj.data import tabular
That to me seems preferable to mucking with sys.path.
Cheers,
// mark
More information about the Python-list
mailing list