HOME Directory in posix and nt

Adam Vandenberg adamv at nwlink.com
Sun Aug 3 18:41:53 EDT 2003


>>Subject: HOME Directory in posix and nt

On POSIX there are various standard ways that people have mentioned.
Under NT, the concept of a home directory is a little iffier.
If you want this directory so you can store some app configuration data (ie,
~/.myappsettings), what you want to do under NT is to get the application
data folder:

>>> import os
>>> print os.getenv('APPDATA')
C:\Documents and Settings\Adam Vandenberg\Application Data

Make a subfolder in there for your app and stick your configuration in the
subfolder.
Unfortunately it isn't very symetric with the POSIX way, so you have to
sniff platforms to figure out which form to use.

Hope this helps.
-Adam






More information about the Python-list mailing list