471,356 Members | 1,603 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,356 software developers and data experts.

Accessing 'Package Data'


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?

S.
Oct 9 '07 #1
1 1219
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
Oct 9 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.