Accessing application data portably

Larry Bates larry.bates at websafe.com
Wed Aug 23 18:55:54 EDT 2006


Tom E H wrote:
> Larry Bates wrote:
>> Tom E H wrote:
>>> 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?
>>>
>> I almost always send along an application.ini file and put the location
>> of where my data is to be stored in that file instead of imbedding (or
>> worse, hard-coding) it in the application program itself.
> 
>> Something like:
>>
>> [init]
>> debug=0
>> quiet=0
>> datafilepath=/usr/lib/myprogram/datafile
> 
> Well that's great, but how do you access the ini file portably?
> 
> Tom

>From my original post:

Then I use ConfigParser in my application...

for help on ConfigParser you can do:

import ConfigParser
help(ConfigParser)

-Larry Bates




More information about the Python-list mailing list