HOME Directory in posix and nt

Kevin Altis altis at semi-retired.com
Mon Aug 4 04:28:39 CEST 2003


On Window you probably want to use the USERPROFILE environment variable. If
you do attempt to use HOME first then check to make sure it is a valid
directory to avoid the problem of an unexpanded %USERPROFILE% variable for
HOME... PythonCard uses this strategy for its configuration files.

os.environ['USERPROFILE']

On Windows 2000: \Documents and Settings\%UserName%
  I think XP uses the same location as Win2K.
On Windows NT 4.0: \Winnt\Profiles\%UserName%
On Windows 98: \Windows\Profiles\%UserName%
On Windows Me: \Windows\Profiles\%UserName%
On Windows 2000 after upgrading from Windows NT 4.0:
\Winnt\Profiles\%UserName%

Somewhere there is an KB or MSDN article about this, but I can't seem to
find it.

ka

"Jörg Maier" <joerg.maier at rz.uni-mannheim.de> wrote in message
news:bgisu6$oi9ct$1 at ID-181971.news.uni-berlin.de...
Hey,

ist there a possibility to get the users homedirectory as environment
variables %HOMEPATH% or $HOME. there must be a way to see system variables
other than
stdout = os.popen('{ echo $HOME } 2>&1 ', 'r') on posix and
stdout = os.popen('echo %HOMEPATH% 2>&1', 'r')
with
home = stdout.readline()
???
--
Hi
I am a signature virus.
Please copy me to your .signature file to help me spread.





More information about the Python-list mailing list