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)
Sorry I forgot some informations.
The error is :
1789, 'LookupAccountName', The trust relationship between this
workstation and the primary domain failed.
As I said, this doesn't always happen, sometimes logon runs successfully
and ACLs are correctly set (this is why I use 'LookupAccountName').
[.. snipped ..]
le dahut: I'm not sure which bit is wrong. I could
point out that traceback.print_exc () will *print*
the current exception (to stdout / stderr, not sure)
and *return* None, so your line:
logging.debug('Error %s'%traceback.print_exc())
probably doesn't do what you want, as it
What strange is is that:
try:
wsec.LookupAccountName(...)
except:
print 'Error'
shows :
- a traceback, as if I didn't put LookupAccountName in a try/except
statement
- the string 'error' so the program has also switched to except as if
the try/except has been correctly interpreted
So we
le dahut wrote:
What strange is is that:
try:
wsec.LookupAccountName(...)
except:
print 'Error'
shows :
- a traceback, as if I didn't put LookupAccountName in a try/except
statement
- the string 'error' so the program has also switched to except as if
the try/except has been
Tim Golden wrote :
le dahut wrote:
What strange is is that:
try:
wsec.LookupAccountName(...)
except:
print 'Error'
shows :
- a traceback, as if I didn't put LookupAccountName in a try/except
statement
- the string 'error' so the program has also switched to except as if
the
le dahut wrote:
Tim Golden wrote :
le dahut wrote:
What strange is is that:
try:
wsec.LookupAccountName(...)
except:
print 'Error'
shows :
- a traceback, as if I didn't put LookupAccountName in a try/except
statement
- the string 'error' so the program has also switched to