Accessing files installed with distutils
Leif K-Brooks
eurleif at ecritters.biz
Tue Feb 22 05:12:02 EST 2005
Frans Englich wrote:
> This is silly. How do I access data files I've installed with distutils? In a
> portable, generic way, I want to find out what is the following path on most
> systems:
>
> /usr/local/lib/python2.4/lib/site-packages/foo/bar.txt
Assuming your module is also in site-packages/foo, I would use:
import os
filename = os.path.join(os.path.dirname(__file__), 'bar.txt')
More information about the Python-list
mailing list