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
> I often use the little hack
>
> import sys
> sys.path.append('..')
i would use sys.path.append(os.path.abspath('..'))
as you might change the current dir of the app later.
> 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.
doo you have printed os.curdir() and os.path.abspath(os.curdir)
do thay return somthing useful? don't have OSX, but i would expect it to
act like a unix too....
--
Chris <clie...@gmx.net>
Chris,
os.path.abspath(os.curdir) works. Thanks.
Rick
--
Richard P. Muller, Ph.D.
r...@wag.caltech.edu
http://www.wag.caltech.edu/home/rpm
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, <openge...@yahoo.ca>
8-CPU Cluster, Hosting, NAS, Linux, LaTeX, python, vim, mutt, tin