On Jan 12, 6:50 pm, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote:
> Update.
> I found a way for getting the home directory of the user but it
> requires to validate the user by providing username+password:
>
> def get_homedir(username, password):
>     token = win32security.LogonUser(
>         username,
>         None,
>         password,
>         win32security.LOGON32_LOGON_NETWORK,
>         win32security.LOGON32_PROVIDER_DEFAULT
>         )
>     return win32profile.GetUserProfileDirectory(token)
>
> What I'd like to do is avoiding the requirement of the password, the
> same way as if I would on UNIX where it would be enough just using the
> pwd module:
>
>  >>> import pwd
>  >>> pwd.getpwnam('user').pw_dir
>  '/home/user'

Check out http://msdn2.microsoft.com/en-us/library/bb762181(VS.85).aspx
for some of the complexities of special directories on Windows.

If you give more details on what you need to get done, someone might
come up with a better solution (my instinct tells me this might be a
database problem, but then I'm a database person so that might not be
terribly relevant ;-)

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

Reply via email to