PEP proposal for user.py (win32 part)
Gillou
nospam at bigfoot.com
Mon Jan 21 11:53:37 EST 2002
More information about the Python-list mailing list
Mon Jan 21 11:53:37 EST 2002
- Previous message (by thread): PEP proposal for user.py (win32 part)
- Next message (by thread): PEP proposal for user.py (win32 part)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi community, The actual detection for the ".pythonrc.py" file does not work with Windows 95/98 and perhaps others (ME ?) because the environment variables HOMEPATH and HOMEDRIVE are unset by default. Im my Win2K box, HOMEPATH is '\' and HOMEDRIVE is 'C:'. Combination of both don't give the user "HOME" directory for Windows. This replacement proposal will find the personal user folder (typically "...\My Documents") in the Windows registry. Replace the code beween... elif os.name == 'nt': # Contributed by Jeff Bauer ...and... pythonrc = os.path.join(home, ".pythonrc.py") ...by the (indented) following ... import _winreg shellkeyId = 'Software\\Microsoft\\Windows\\CurrentVersion\\explorer\\Shell Folders' shellkey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, shellkeyId) home = _winreg.QueryValueEx(shellkey, 'Personal')[0] _winreg.CloseKey(shellkey) This has been successfully tested with Windows 98se, Windows 2000 pro and Python 2.1.2. Can you please reply in this thread if this works on other Win32 platforms (95/ME/NT/XP). Any other comment ? --Gillou
- Previous message (by thread): PEP proposal for user.py (win32 part)
- Next message (by thread): PEP proposal for user.py (win32 part)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list