My own, less than perfect, way of finding the users home directory is like this:

def personal_directory ( default = None ):
pdir = None
if sys.platform.startswith ( 'win' ):
import _winreg
reg = _winreg.ConnectRegistry ( None, _winreg.HKEY_CURRENT_USER )
pkey = _winreg.OpenKey ( reg, r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" )
pdir = _winreg.QueryValueEx ( pkey, 'Personal' )[0]
_winreg.CloseKey ( pkey )
_winreg.CloseKey ( reg )
else:
pdir = os.getenv ( 'HOME' )
if not pdir:
pdir = default
return pdir


--
Michael <[EMAIL PROTECTED]>
http://kavlon.org

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to