Nevermind... os.path.dirname (__file__)
On May 17, 9:44 pm, are Dogue <are.do...@gmail.com> wrote: > Hi there, > > I have a problem that I can't seem to solve after quite a bit of > searching, probably because I can't find the right terms to search > for. > > Basically, here's the situation. Let's say I have a file at ~/foo/bin/ > foo.py that imports a script that at ~/bar/bin/bar.py. The imported > file needs to load something from '~/bar/bin/data/', but I cannot hard > code the full path. Instead, what I need is to have something in > bar.py like > > dir = .... # Not sure what this line should be > datadir = dir + '/data/' > > If I use sys.path[0] or os.getcwd(), then when I import the file from > ~/foo/bin/, I get that dir is '~/foo/bin' rather than '~/bar/bin' > > I hope this explanation makes sense. If you have any insights, I would > be most appreciative. > > Thanks > Are -- http://mail.python.org/mailman/listinfo/python-list