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

le dahut le.dahut at laposte.net
Fri Mar 14 16:40:34 CET 2008

What strange is is that:

   print 'Error'

shows :
- a traceback, as if I didn't put LookupAccountName in a try/except 
- the string 'error' so the program has also switched to except as if 
the try/except has been correctly interpreted

So we can say that I get the two behaviours in one. At the exception 
that the traceback is not complete, it only talks about the line 
containing LookupAccountName, not entire traceback (the caller function 
and its parents).

Tim Golden a écrit :
> [.. 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 will
> log the string "Error None". But this may be no
> more than incidental to your issue.
>  >> 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 ?
> The fact that you're getting "logon.exe.log" suggests to me that
> you're using py2exe, which has its own setup for trapping
> traceback and things which go to stdout. Is this the case?
> Hopefully someone else can see more clearly than I am, but
> if they can't, you're going to have to come up with a *really*
> small example of what does or doesn't work.
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32

More information about the python-win32 mailing list