I write a Python program. It will contain some images (in .png format), some
audio files (as .ogg) etc. Now I think where should my installer put these
files and how should I access them. What is the normal Python way of doing
that? I think about puting these files in /usr/share/myprogram and then
reading it the normal way (so the path "/usr/share/myprogram" would be just
hardwired in my program). Is it the way one usually does it in Python
program or is there any more sofisticated way?
I think this question is mostly independent of the issue of what's used
to actually install the files.
My answer is to put read-only files right with the py* files, and
writable files in the user's space. In the former case, you can find
the files by parsing __file__ for one of your modules. In the latter
case, it's system dependent. But I'd start with a single file which is
put in a conventional place (for your target OS). That will be a
configuration file ("preferences files"), which specifies, among other
things, where everything else will be written. Somebody else will have
to tell you what the Unix convention would be.
In the case of Windows, the first "file" would just be a registry
entry. And I wouldn't write any of the actual files till the user had
configured things, either during installation or during the first run
(with a File->Preferences menu setup).