How do I refer to a data file relative to a package or installation directory?

Parzival ConfuseYourSpamBot-parzp at ConfuseYourSpamBot.shaw.ca
Sat Oct 9 02:08:20 EDT 2004


I have a package that includes some data files. I am planning to use a
distutils setup script to install the package. How can I compute a path
name for such a data file that will always be relative to my package
root directory (i.e. both when installed, and in my development directory?)

Or to rephrase, say the data file is mypkg/data/foo.dat relative to the
package root "mypkg" (the directory that holds __init__.py). Is there an
enquiry that will return the absolute path prefix for mypkg?


-- Parzival
-- Reply-to is confuggled: parzp (@) shaw (.) ca




More information about the Python-list mailing list