ExpatError: not well-formed error

127 views
Skip to first unread message

iiijjjiii

unread,
Oct 29, 2010, 3:00:42 PM10/29/10
to JSONRPClib (Python)
I recently upgraded from python 2.6 to python 2.7. Using jsonrpclib
0.11 I now get the following error.

Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/jsonrpclib/jsonrpc.py", line
218, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.7/site-packages/jsonrpclib/jsonrpc.py", line
168, in _request
response = self._run_request(request)
File "/usr/lib/python2.7/site-packages/jsonrpclib/jsonrpc.py", line
186, in _run_request
verbose=self.__verbose
File "/usr/lib/python2.7/xmlrpclib.py", line 1264, in request
return self.single_request(host, handler, request_body, verbose)
File "/usr/lib/python2.7/xmlrpclib.py", line 1297, in single_request
return self.parse_response(response)
File "/usr/lib/python2.7/xmlrpclib.py", line 1462, in parse_response
p.feed(data)
File "/usr/lib/python2.7/xmlrpclib.py", line 557, in feed
self._parser.Parse(data, 0)
ExpatError: not well-formed (invalid token): line 1, column 0

Any suggestions?

Josh Marshall

unread,
Oct 29, 2010, 3:27:45 PM10/29/10
to jsonr...@googlegroups.com
Thanks for emailing the group --

I haven't had a chance to test on 2.7 yet -- I think I might know what the issue is, but just for kicks could you try running the tests first and see if they generate the same output?

It will be a bit before I can spin up a 2.7 test environment, so anything you can tell me about what you were doing (what kind of information you were passing, etc.) will help me nail down the issue. It looks like it's a dependency on XMLRPClib that's causing the problem, but I can't know for certain till I can get 2,7 up.

Josh Marshall

iiijjjiii

unread,
Oct 29, 2010, 5:13:05 PM10/29/10
to JSONRPClib (Python)
Here is a sample output from running the tests. Pretty much the same.

$ python tests.py
EEEEEEEEEEEEEEEEEEE
======================================================================
ERROR: test_connect (__main__.InternalTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "tests.py", line 275, in test_connect
result = client.ping()
File "/root/repos/git/jsonrpclib/jsonrpclib/jsonrpc.py", line 220,
in __call__
return self.__send(self.__name, kwargs)
File "/root/repos/git/jsonrpclib/jsonrpclib/jsonrpc.py", line 168,
in _request
response = self._run_request(request)
File "/root/repos/git/jsonrpclib/jsonrpclib/jsonrpc.py", line 186,
in _run_request
verbose=self.__verbose
File "/usr/lib/python2.7/xmlrpclib.py", line 1264, in request
return self.single_request(host, handler, request_body, verbose)
File "/usr/lib/python2.7/xmlrpclib.py", line 1303, in single_request
return self.parse_response(stream)
File "/usr/lib/python2.7/xmlrpclib.py", line 1462, in parse_response
p.feed(data)
File "/usr/lib/python2.7/xmlrpclib.py", line 557, in feed
self._parser.Parse(data, 0)
ExpatError: not well-formed (invalid token): line 1, column 0

Let me know if there is anything else I can do.

Regards,
Jim Karsten


On Oct 29, 3:27 pm, Josh Marshall <catchj...@gmail.com> wrote:
> Thanks for emailing the group --
>
> I haven't had a chance to test on 2.7 yet -- I think I *might *know what the

Josh Marshall

unread,
Oct 30, 2010, 2:02:06 AM10/30/10
to jsonr...@googlegroups.com
Okay, I've posted an update to github.

It turns out I was not overwriting things in the best possible way, but it worked for 2.5 and 2.6. So this time I've overwritten the getparser method on the Transport subclass, and made two little proxy classes that concatenate the data received. 

Anyway, I tested it on a sparkly new Ubuntu 10.10 install with both the built-in 2.6 and I grabbed 2.7 from the repo, and the tests all passed. I also checked it on 2.5 in Mac OS X 10.5 and it passed the tests, so hopefully this fixes the bug. Let me know if this doesn't solve it for you, or if you hit any other issues.

Thanks for your help making the library better!

Josh Marshall

iiijjjiii

unread,
Nov 1, 2010, 9:17:03 PM11/1/10
to JSONRPClib (Python)
Works for me as well. Thanks for the prompt response.

Jim Karsten
Reply all
Reply to author
Forward
0 new messages