[python-win32] win32security.LogonUser

Tim Golden mail at timgolden.me.uk
Thu Jul 24 10:17:07 CEST 2008


_ _ wrote:
> Hi... How are you?
> 
> I use win32extensions... I
> have a problem, can you help me please?
> 
> 
> import win32security
> domain = "myNetworkDomain"
> username = "testUser"
> password = "testUser"
> 
> hUser = win32security.LogonUser (username, domain, password,
> win32security.LOGON32_LOGON_
> NETWORK,win32security.LOGON32_PROVIDER_DEFAULT)
> win32security.ImpersonateLoggedOnUser(hUser)
> f = file (r"D:\test\local\kkk.txt", "w")
> 
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> IOError: [Errno 2] No such file or directory: 'D:\\test\\local\\kkk.txt'
> 
> (D:\test\local exists!!) What is the problem?...

Well, let's take a few casts in the absence of
more complete data:

1) Is "D:" a network drive which isn't mapped for the other user?

2) Does the "testUser" actually have security access
to D:\\test\\local\\kkk.txt and at least traverse access
to the intervening directories? I wouldn't actually
expect this error if they didn't (rather, a permissions
error, but who knows?)

3) (Since you've obviously had to munge the code a little
for security) are you absolutely sure that the path you've
specified *does* exist?

TJG



More information about the python-win32 mailing list