Re: [python-win32] Error 1789 during logon, except not really called

2008-03-14 Thread Tim Golden
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' s

Re: [python-win32] Error 1789 during logon, except not really called

2008-03-14 Thread le dahut
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

Re: [python-win32] Error 1789 during logon, except not really called

2008-03-14 Thread Tim Golden
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

Re: [python-win32] Error 1789 during logon, except not really called

2008-03-14 Thread le dahut
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

Re: [python-win32] Error 1789 during logon, except not really called

2008-03-14 Thread Tim Golden
[.. 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

Re: [python-win32] Error 1789 during logon, except not really called

2008-03-14 Thread le dahut
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')

[python-win32] Error 1789 during logon, except not really called

2008-03-14 Thread le dahut
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) a