Finding user's home dir

Bernhard Herzog bh at intevation.de
Thu Feb 3 08:59:25 EST 2005


Peter Hansen <peter at engcorp.com> 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 didn't know about it.  I didn't either...

The purpose of the user module is executing ~/.pythonrc.py, which may
not desirable.  It definitely shouldn't be done by a library, for
instance.  Also, that the user's home directory is available as
user.home is not documented, and I for one wouldn't want to rely on
that.

   Bernhard

-- 
Intevation GmbH                                 http://intevation.de/
Skencil                                           http://skencil.org/
Thuban                                  http://thuban.intevation.org/



More information about the Python-list mailing list