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,
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
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
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
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.
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
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
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
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
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
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
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
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
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
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
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
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
on win xp home, python 2.4 its also correct for me
--
http://mail.python.org/mailman/listinfo/python-list
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
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
20 matches
Mail list logo