cross platform application configuration files

Lee Harr missive at frontiernet.net
Fri Feb 28 15:13:49 EST 2003


In article <b3och6$1kl$1 at peabody.colorado.edu>, Fernando Perez wrote:
>> My question, though, is more about where to put the file,
>> and how to find it again on any platform.
> 
> You may find the code below useful.  That's what I use to find what '~'
> would be in a reasonably portable manner so my code doesn't barf completely
> under windows if it has to run there.
> 

> def get_home_dir():
>     """Return the closest possible equivalent to a 'home' directory.
> 
>     For Posix systems, this is $HOME, and on NT it's $HOMEDRIVE\$HOMEPATH.
> 
>     Currently only Posix and NT are implemented, a HomeDirError exception is
>     raised for all other OSes. """ #'
>     


Yea! This is more what I was talking about.

Is this pep-worthy?

Does not seem like it should go in the configparser module,
but where else?






More information about the Python-list mailing list