Le 22 juil. 09 à 23:34, Frank Niessink a écrit :
>
> except Exception, instance:
> showerror(unicode(instance), # line 1992
> caption=_('Error opening attachment'),
> style=wx.ICON_ERROR)
>
> I suspect there was some error in opening the attachment and then
> showerror (=wx.MessageBox) failed and raised the exception.
>
> I can't remember why we are doing "unicode(instance)". Why are we
> getting a UnicodeDecodeError?
>
A guess: sometimes on Windows (french), win32com raises exceptions
with an error message containing non-ascii characters. But these
exceptions only define __str__ and thus when printed, try to convert
to ASCII. And bam, UnicodeDecodeError. Maybe this explicit cast to
unicode was an attempt to work around that, but it won't work. The
only work-around I've found in this situation (short of not using the
representation of the instance of course) is to iterate over
instance.args and handle each object found according to its type...