How to get the user name, and to show a select directory dialog?
Arnal
arnaud at tribu.ch
Sun May 25 16:58:47 EDT 2003
In 3ECE20B5.41ADA88D at engcorp.com, "Peter Hansen" <peter at engcorp.com>
wrote :
> Tim Golden wrote:
>>
>> The first has already been answered (win32api.GetUserName), altho' I
>> would point out that this won't work on Win9x (try
>> win32wnet.WNetGetuser instead).
>
> Not so sure about that. I'm on Windows 98 SE:
>
> Python 2.2.2 (#37, Oct 14 2002, 17:02:34) [MSC 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import win32api
>>>> win32api.GetUserName()
> 'phansen'
>
> So, looks like that *does* work.
>
>>>> import win32wnet
>>>> win32wnet.WNetGetuser()
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> AttributeError: 'module' object has no attribute 'WNetGetuser'
>>>> win32wnet.WNetGetUser()
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> RuntimeError: Couldn't get the buffer size!
>
> Looks like, possibly WNetGetUser() (note capitalization) exists but
> has a problem internally, but WNetGetuser() does not even exist.
>
> -Peter
Ok, thanks! I'll try.
More information about the Python-list
mailing list