Finding application data after install - a solution?

Wolodja Wentland wentland at
Thu Sep 24 13:21:59 CEST 2009

On Thu, Sep 24, 2009 at 04:07 -0300, Gabriel Genellina wrote:
> >I do not intentionally focus on UNIX type systems, but I have grown up
> >with *nix and I rather follow one scheme than none at all. But the
> >proposed way works on Windows as well, although the users might find
> >previously unseen directories like 'PREFIX/share/foo/doc' and the like
> >on their system.

> I think many Windows users would say WTF!? when seeing those
> directories - and send cordial greetings to you, your parents and
> your whole family :)

That is probably true, but Windows has a 'etc' directory
(c:\windows\system32\drivers\etc) which AFAIK contains the hosts file
and/or other goodies from *NIX.

> Instead of ending with, e.g., a directory like c:\usr\share\foo\doc,
> your program should ask the OS for the special folder
> CSIDL_COMMON_APPDATA and add the foo\doc part. Or any other suitable
> standard folder. 

Is CSIDL_COMMON_APPDATA and environment variable set on all Windows
flavours? Are there versions that relying on this env var (if it is one)
will cause havoc and the death of millions of kittens? (ie. is it
available on all versions)

Where can I find Information on these "other" standard folders? Sorry,
but I have not used a Windows machine in ages.

> A directory like c:\usr\share\foo on Windows is as ridiculous as
> /Documents\ and\ Settings/All\ Users/Application\ Data/foo on any unix
> like system.

Agreed! Although I find the *NIX flavour more palatable to my eye ;-)

> >As $DATA_PREFIX is only known at build time there was (until now) no
> >reliable way to find the data if the only information one can get is
> >$LIB_PREFIX, because these two might be totally unrelated.
> You should probably raise this issue at the distutils-sig mailing
> list:

I already did [1] but the distutils developers are quite busy discussing
a the new format for setup.cfg. I did not got any feedback on the
solution I developed and thought that other Python users might have a
better solution to this problem.

How do *you* deal with application data in your programs? Is there a way
that works on as many platforms as possible?

so long


-------------- 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