[SciPy-user] paths relative to a python package
Zane Selvans
zane at ideotrope.org
Tue Apr 1 19:37:31 EDT 2008
I know this isn't scipy specific but...
If you have a data file that's distributed with a python package, how do
you refer to it relative to the location that the package ultimately
gets installed? Is there a package_root variable or something?
e.g. in my package directory let's say I have:
__init__.py
MyModule.py
datadir
and within datadir:
data1.dat
data2.dat
...
How do I, within MyModule.py tell the program to open one of the data files?
If I just do open('datadir/data1.dat') it'll try and open that dir/file
relative to wherever the python program that imported MyModule is
running, right? Which isn't what I want.
Thanks for any insight,
Zane
--
Zane Selvans
Amateur Human
zane at ideotrope.org
303/815-6866
PGP Key: 55E0815F
-------------- next part --------------
A non-text attachment was scrubbed...
Name: zane.vcf
Type: text/x-vcard
Size: 254 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20080401/53aa6629/attachment.vcf>
More information about the SciPy-User
mailing list