[Twisted-Python] xmlstream, parser bug & utf16 support

James Bunton james at delx.cjb.net
Mon Aug 30 17:45:30 EDT 2004

Hi all. I've started using the Jabber support in Twisted for building PyMSNt 
(a python MSN transport).

I seem to have found a bug in the XML parser. Firstly, it seems to raise an 
exception whenever an incoming packet has an attribute xml:lang="en"
For example..
<iq to="someaddr" type="get" xml:lang="en"/> will cause the parser to raise an 

Traceback (most recent call last):
   File "/usr/lib/python2.3/site-packages/twisted/internet/default.py", line 
526, in doSelect
     _logrun(selectable, _drdw, selectable, method, dict)
   File "/usr/lib/python2.3/site-packages/twisted/python/log.py", line 65, in 
     callWithContext({"system": lp}, func, *args, **kw)
   File "/usr/lib/python2.3/site-packages/twisted/python/log.py", line 52, in 
     return context.call({ILogContext: newCtx}, func, *args, **kw)
   File "/usr/lib/python2.3/site-packages/twisted/python/context.py", line 43, 
in callWithContext
     return func(*args,**kw)
--- <exception caught here> ---
   File "/usr/lib/python2.3/site-packages/twisted/internet/default.py", line 
535, in _doReadOrWrite
     why = getattr(selectable, method)()
   File "/usr/lib/python2.3/site-packages/twisted/internet/tcp.py", line 255, 
in doRead
     return self.protocol.dataReceived(data)
"/usr/lib/python2.3/site-packages/twisted/protocols/xmlstream.py", line 158, 
in dataReceived
   File "/usr/lib/python2.3/site-packages/twisted/xish/domish.py", line 593, 
in parse
   File "/usr/lib/python2.3/site-packages/twisted/xish/domish.py", line 602, 
in _onStartElement
     attrs[k.split(" ")] = v

Any help on fixing this would be appreciated.

Also, does anybody have any clues on how to send utf16 characters in the 
xmlstream? I can't seem to work it out.

Thanks in advance..



More information about the Twisted-Python mailing list