Go Back   Velocity Reviews > Newsgroups > Python
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

Python - Accessing 'Package Data'

 
Thread Tools Search this Thread
Old 10-09-2007, 08:28 AM   #1
Default 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.


Stefan Arentz
  Reply With Quote
Old 10-09-2007, 09:58 AM   #2
Diez B. Roggisch
 
Posts: n/a
Default Re: Accessing 'Package Data'
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


Diez B. Roggisch
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wonderful data input with web reporting tool freezea Software 0 09-09-2009 05:30 AM
Re: HDD Data Recovery Glenn A+ Certification 0 08-29-2006 04:01 PM
Address Bus and External Data Bus Confusion LoXodonte A+ Certification 1 04-18-2006 10:09 PM
The Practice Test Package Development: A New Service on the Certification Market David Johnson A+ Certification 0 01-19-2005 10:52 AM
Re: Backing up data to reinstall or replace a Operating system? Barry Watzman A+ Certification 0 08-21-2003 06:59 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46