Finding user's home dir

2005-02-09 Thread Alec Wysoker
Could you explain a little more clearly what the problem is? In the implementation of expanduser in Python 2.3.4, it uses the value of HOME env var if it exists, otherwise, it uses HOMEDRIVE + HOMEPATH. I don't have access to a Win 2K machine right now, but my recollection is that when I did,

Re: Finding user's home dir

2005-02-03 Thread Peter Hansen
Nemesis wrote: On my Win2000 box it returns "%USERPROFILE%". That's no surprise because if you look at the code it try to use os.environ["HOME"] (as os.path.expanduser() does). And on my Win2000 system this information points to "%USERPROFILE%" field (I don't know why, I'm not the administrator of

Re: Finding user's home dir

2005-02-03 Thread Nemesis
Mentre io pensavo ad una intro simpatica "Peter Hansen" scriveva: > Miki Tebeka wrote: >>>Hi all, I'm trying to write a multiplatform function that tries to >>>return the actual user home directory. >>>... >> >> What's wrong with: >> from user import home >> which does about what your code do

Re: Finding user's home dir

2005-02-03 Thread Nemesis
Mentre io pensavo ad una intro simpatica "Miki Tebeka" scriveva: >> Hi all, I'm trying to write a multiplatform function that tries to >> return the actual user home directory. >> ... > What's wrong with: > from user import home > which does about what your code does. On my Win2000 box it ret

Re: Finding user's home dir

2005-02-03 Thread Michael
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.

Re: Finding user's home dir

2005-02-03 Thread Duncan Booth
Peter Hansen wrote: > Nemesis, please use the above recipe instead, as it makes > the more reasonable (IMHO) choice of checking for a HOME > environment variable before trying the expanduser("~") > approach. This covers folks like me who, though stuck > using Windows, despise the ridiculous Micro

Re: Finding user's home dir

2005-02-03 Thread Peter Hansen
Bernhard Herzog wrote: Peter Hansen <[EMAIL PROTECTED]> writes: Miki Tebeka wrote: Hi all, I'm trying to write a multiplatform function that tries to return the actual user home directory. ... What's wrong with: from user import home which does about what your code does. :-) I suspect he simply

Re: Finding user's home dir

2005-02-03 Thread Bernhard Herzog
Peter Hansen <[EMAIL PROTECTED]> writes: > Miki Tebeka wrote: >>>Hi all, I'm trying to write a multiplatform function that tries to >>>return the actual user home directory. >>>... >> What's wrong with: >> from user import home >> which does about what your code does. > > :-) > > I suspect he

Re: Finding user's home dir

2005-02-03 Thread Lars
Works great with Python 2.3.4 on... dare I say it... windows xp >>> getHomeDir() 'C:\\Documents and Settings\\Lars' Regards Lars Nemesis wrote: > (..) > Please, could you test it on your systems and tell me what you got? > (..) -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding user's home dir

2005-02-03 Thread Peter Hansen
Miki Tebeka wrote: Hi all, I'm trying to write a multiplatform function that tries to return the actual user home directory. ... What's wrong with: from user import home which does about what your code does. :-) I suspect he simply didn't know about it. I didn't either... Nemesis, please use t

Re: Finding user's home dir

2005-02-03 Thread Marc Christiansen
Miki Tebeka <[EMAIL PROTECTED]> wrote: > Hello Nemesis, > >> Hi all, I'm trying to write a multiplatform function that tries to >> return the actual user home directory. >> ... > What's wrong with: >from user import home > which does about what your code does. Except it also execfile()s $HOME

Re: Finding user's home dir

2005-02-03 Thread Miki Tebeka
Hello Nemesis, > Hi all, I'm trying to write a multiplatform function that tries to > return the actual user home directory. > ... What's wrong with: from user import home which does about what your code does. Bye. -- Mi

Re: Finding user's home dir

2005-02-02 Thread Christian Dieterich
On Dé Céadaoin, Feabh 2, 2005, at 13:26 America/Chicago, Nemesis wrote: Hi all, I'm trying to write a multiplatform function that tries to return the actual user home directory. I saw that Please, could you test it on your systems and tell me what you got? I'd like to know what it returns on diffe

Re: Finding user's home dir

2005-02-02 Thread Kartic
Nemesis said the following on 2/2/2005 2:26 PM: Hi all, I'm trying to write a multiplatform function that tries to def getHomeDir(): ''' Try to find user's home directory, otherwise return current directory.''' Please, could you test it on your systems and tell me what you got? I'd like to kno

Re: Finding user's home dir

2005-02-02 Thread Nick
Python 2.4 (#1, Jan 1 2005, 21:33:55) [GCC 3.3.4] on linux2 Slackware 10 Current Works! Nice. -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding user's home dir

2005-02-02 Thread Steve Holden
Nemesis wrote: Hi all, I'm trying to write a multiplatform function that tries to return the actual user home directory. I saw that os.path.expanduser("~") works on Linux but on Windows2000 (at least on the win I used) it returns %USERPROFILE%, so I tried os.environ["HOME"] and it gave me the same

Re: Finding user's home dir

2005-02-02 Thread Timothy Grant
On Wed, 02 Feb 2005 11:30:34 -0800 (PST), Nemesis <[EMAIL PROTECTED]> wrote: > Hi all, I'm trying to write a multiplatform function that tries to > return the actual user home directory. I saw that > os.path.expanduser("~") works on Linux but on Windows2000 (at least on > the win I used) it returns

Re: Finding user's home dir

2005-02-02 Thread [EMAIL PROTECTED]
on win xp home, python 2.4 its also correct for me -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding user's home dir

2005-02-02 Thread Mark Nenadov
On Wed, 02 Feb 2005 19:26:00 +, Nemesis wrote: > Please, could you test it on your systems and tell me what you got? > I'd like to know what it returns on different operating systems because > I'm developing a multiplatform software. > > Thank you all. I tried your function in my environment

Finding user's home dir

2005-02-02 Thread Nemesis
Hi all, I'm trying to write a multiplatform function that tries to return the actual user home directory. I saw that os.path.expanduser("~") works on Linux but on Windows2000 (at least on the win I used) it returns %USERPROFILE%, so I tried os.environ["HOME"] and it gave me the same results. So I e