Accessing application data portably

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


Larry Bates wrote:
>> Well that's great, but how do you access the ini file portably?
> 
> From my original post:
> 
> Then I use ConfigParser in my application...

Thanks, but where in the directory structure do you put the ini file on
different platforms?  Presumably you have to hard-code that into the source
and then do operating system type detection?

i.e. if I make my config parser:

import ConfigParser
config = ConfigParser.ConfigParser()
config.read(filename)

What do you use for filename on Windows?  What on Linux?  OSX? etc.  How do
you detect which operating system you are running on?

Tom




More information about the Python-list mailing list