[Tutor] Odd traceback - invalid token when extracting contents of XML data element
Andrew Robert
andrew.arobert at gmail.com
Mon Jun 12 15:56:09 CEST 2006
Hi Everyone,
Attached are three scripts that I intend to use for transporting a file
via IBM's WebSphere MQSeries middle-ware.
The sender script uses a regular expression to replace characters not
[a-z][A-Z][0-9] or white space with their hex value equivalents.
The purpose of this is to make the contents of a transported file
viewable inside MQSeries queues.
The attached code works just fine for transporting ASCII text files but
it bombs with the following trace when run against binary files.
Does anyone know why this might be occurring?
Traceback (most recent call last):
File "M:\MQ\MQ\Scripts\receiver.py", line 267, in ?
receiver.run()
File "M:\MQ\MQ\Scripts\receiver.py", line 110, in run
self.get()
File "M:\MQ\MQ\Scripts\receiver.py", line 139, in get
tree = ElementTree(file=buff)
File "C:\Python24\Lib\site-packages\elementtree\ElementTree.py", line
543, in __init__
self.parse(file)
File "C:\Python24\Lib\site-packages\elementtree\ElementTree.py", line
583, in parse
parser.feed(data)
File "C:\Python24\Lib\site-packages\elementtree\ElementTree.py", line
1242, in feed
self._parser.Parse(data, 0)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 3,
column 39
I think that a particular character is perhaps not being translated to
ascii as required but I don't know which one it mught be.
Part of the reason for this encoding mechanism is so that it plays nice
with existing perl code already in place.
Not my choice, but what can you do.
Any help you can provide on this would be greatly appreciated.
--
Thank you,
Andrew Robert
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sender.py
Url: http://mail.python.org/pipermail/tutor/attachments/20060612/6c17823d/attachment-0002.pot
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: file_encoder.py
Url: http://mail.python.org/pipermail/tutor/attachments/20060612/6c17823d/attachment-0001.asc
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: receiver.py
Url: http://mail.python.org/pipermail/tutor/attachments/20060612/6c17823d/attachment-0003.pot
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 208 bytes
Desc: OpenPGP digital signature
Url : http://mail.python.org/pipermail/tutor/attachments/20060612/6c17823d/attachment-0001.pgp
More information about the Tutor
mailing list