Python seems to be ignoring my except clause...
Adam W.
AWasilenko at gmail.com
Tue Feb 19 08:41:40 EST 2008
I am trying to handle a Unicode error but its acting like the except
clause is not even there. Here is the offending code:
def characters(self, string):
if self.initem:
try:
self.data.append(string.encode())
except:
self.data.append('No habla la Unicode')
And the exception:
File "C:\Users\Adam\Desktop\XMLWorkspace.py", line 65, in characters
try:
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2026' in
position 83: ordinal not in range(128)
Its got to be something really dumb I'm missing, this make no sence.
More information about the Python-list
mailing list