[python-win32] Error 1789 during logon, except not really called
le dahut
le.dahut at laposte.net
Fri Mar 14 11:38:28 CET 2008
Hello,
I'm using this code :
mypdc = 'mypdc'
dusers = 'DomName\DomainUsers'
obj = 'C:\\Mylogfile.log'
try:
domainusers_sid = wsec.LookupAccountName(mypdc, dusers)[0]
info = wsec.DACL_SECURITY_INFORMATION
sd = wsec.GetFileSecurity(obj, info)
acl = sd.GetSecurityDescriptorDacl()
acl.AddAccessAllowedAceEx(wsec.ACL_REVISION_DS,
wsec.OBJECT_INHERIT_ACE, wf.FILE_ALL_ACCESS, domainusers_sid)
# maj du Security Descriptor
sd.SetSecurityDescriptorDacl(1, acl, 0)
# application sur l'objet
wsec.SetFileSecurity(obj, info, sd)
except Exception, e:
logging.error("ACLs error %s"%([obj, dusers, e]))
logging.debug('Error %s'%traceback.print_exc())
At logon time, it can occur that wsec.LookupAccountName fails. The
except statement is called but an exception is thrown as well and I get
a file logon.exe.log in which I can read the traceback. And finally
traceback.print_exc() returns None.
Why does this produce a traceback instead of really except it ?
More information about the python-win32
mailing list