What's the perfect (OS independent) way of storing filepaths ?

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Mon Oct 20 00:26:21 CEST 2008

On Sun, 19 Oct 2008 15:40:32 +0000, Duncan Booth wrote:

> Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> wrote:
>> In Linux, config files should go into:
>> ~/.<appname>/ or /etc/<appname>/
>> In Windows (which versions?) then should go into the Documents And
>> Settings folder, where ever that is.
>> There's no single string which can represent both of these conventions!
> The first of those should do nicely for both Linux and Windows:
>>>> os.path.normpath(os.path.expanduser('~/.appname'))
> 'C:\\Documents and Settings\\Duncan\\.appname'

Except Windows users will be wondering why they have a directory starting 
with '.' in their home directory. Dot to make files hidden is not AFAIK 
supported by Windows.


More information about the Python-list mailing list