Correctness: sys.path.append("..")

Jason Orendorff jason at jorendorff.com
Tue Jan 8 21:50:54 EST 2002


> > 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:
>
> I have modules in biz that want, nay, need to use modules in presentation.
>
> "Ideally", I'd have some sort of syntax like this:
>    import ../presentation.layout
> or
>    import __parent__.presentation.layout

# This too has the benefit of working;
# whether from biz/customer.py or anywhere else.
import myproj.presentation.layout


## Jason Orendorff    http://www.jorendorff.com/





More information about the Python-list mailing list