Accessing application data portably

Tom E H tom-2006 at jaguarpaw.get-rid-of-this-bit.co.uk
Wed Aug 23 12:20:56 EDT 2006


My Python application includes some data files that need to be accessed by
modules I distribute with it.

Where can I put them, and how should I arrange my code, so that it works
across platforms?

On Linux, I could install the data to "/usr/lib/myprogram/datafile", and
on Windows to "datafile" relative to where the executable (made by
py2exe) is installed.  Then I could detect the operating system, and choose
appropriately.

To be that explicit seems undesirable.  Any cleverer ideas?

Tom

(Please CC me on replies: I'm not subscribed.  The From address is munged)




More information about the Python-list mailing list