Accessing 'Package Data'
Diez B. Roggisch
deets at nospam.web.de
Tue Oct 9 04:58:13 EDT 2007
Stefan Arentz wrote:
>
> At http://docs.python.org/dist/node12.html it is described how to add
> package data to a module. This was pretty easy to do, but now how do I
> access this data from my module? Is there an API to load a 'package
> resource' ala Java's classloader?
You can always use os.path + the __file__-attribute of the containing
package.
And there is the 3rd-party pkg_resources, part of setuptools:
http://peak.telecommunity.com/DevCenter/PkgResources
Diez
More information about the Python-list
mailing list