Problem with UnicodeError and xml.dom.minidom
paulp at ActiveState.com
Sun Jun 10 23:16:17 EDT 2001
Gustaf Liljegren wrote:
> This is line 37 in count.py. No non-ASCII characters here, and it works
> fine in Idle. I'm paralysed. Can someone break the spell?
Something is weird with your traceback. I don't see how this line could
generate this error:
File "E:\python\_xmlplus\dom\minidom.py", line 144, in appendChild
if node.nodeType not in self.childNodeTypes:
UnicodeError: ASCII decoding error: ordinal not in range(128)
It doesn't seem to be doing string manipulations at all. There is a
"unicode" builtin that will convert text to Unicode. Sprinkle some calls
to that around like this:
Sprinkle some calls to that around your code and even around the library
code if you have to.
Also, as a strategy, consider unicode-ing all of your input data as soon
as you read it in:
somestring = unicode(somestring)
Take a recipe. Leave a recipe.
Python Cookbook! http://www.ActiveState.com/pythoncookbook
More information about the Python-list