Add parent directory to path?

William Park opengeometry at NOSPAM.yahoo.ca
Tue Jul 2 16:00:09 EDT 2002


Rick Muller <rpm at wag.caltech.edu> wrote:
> I often use the little hack
> 
> import sys
> sys.path.append('..')
> 
> to add the parent directory to the python path. It's nice, e.g., if I 
> want to keep a directory below the program directory that contains test 
> scripts, but still let them easily import the parent directory's modules.
> 
> This hack worked on Unix and Windows/Cygwin, which up until recently 
> were my only build targets. Now I just got a Apple OS X box, and I find 
> that, despite the BSD heritage, this little hack no longer works. Is 
> there a good platform-independent way of doing this? I figure that 
> something like this should live in os.path, but I didn't find anything 
> appropriate.
> 
> Thanks in advance for any help anyone can offer.
> 
> Rick

What does this have to do with the original post of this thread?  Please
start new thread for new subject.

-- 
William Park, Open Geometry Consulting, <opengeometry at yahoo.ca>
8-CPU Cluster, Hosting, NAS, Linux, LaTeX, python, vim, mutt, tin



More information about the Python-list mailing list