where do I put resources (images, audio files) when I wrote Python program?

mhearne808 mhearne808 at gmail.com
Mon Jul 27 14:57:28 EDT 2009

On Jul 27, 12:43 pm, Piotrek <niedzi... at gazeta.pl> wrote:
> Hello,
> 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?

Usually the preferred method is either distutils (http://
docs.python.org/library/distutils.html#module-distutils) or setuptools
(http://peak.telecommunity.com/DevCenter/setuptools).  Either of these
will allow you to create source (".tar.gz") or binary distributions
that can be installed relatively easily on a target machine.

Good luck,

More information about the Python-list mailing list