Finding application data after install - a solution?

Wolodja Wentland wentland at
Tue Sep 22 06:34:10 CEST 2009

On Mon, Sep 21, 2009 at 23:52 -0300, Gabriel Genellina wrote:
> En Sat, 19 Sep 2009 12:03:52 -0300, Wolodja Wentland
> <wentland at> escribió:
> >reliably finding distribution data from your program seems to be an
> >unsolved issue for programs packaged with distutils.


> Isn't pkgutil.get_data() what you're looking for?
> I'm not sure it covers all your use cases though.

No that pkgutil.get_data() is exactly *not* what I am looking for ;-)

I have a library which *could* use external data and use this additional
information to cover more cases, but works perfectly fine without this
data. The data could change more frequently than i want to release the

I use distutils data_files=... to have the data installed, but there
is/was (until the recipe I posted here) no way to find that data again,
because the admin could define arbitrary prefixes for libs, scripts and
data. That means that there might be absolutely no relation between the
module path and the data file path.

I want to:

    1. Give administrators the freedom to install the data wherever they
    2. Adhere to the FHS (installing data within modules breaks it)
    3. Be able to find that data again regardless of the installation
      scheme used

1 and 2 are easily solved... It was just not possible to find the data
again. The snippet in the original code solves that.

I still don't think that relying on these internal structures within
distutils is supported, but can't think of a better way.

so long and thanks for all the fish

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 852 bytes
Desc: Digital signature
URL: <>

More information about the Python-list mailing list