maxcutler/python-wordpress-xmlrpc — Issue #12: ExpatError: XML or text declaration not at start of entity
Author: pafcu
Created: 2011-10-10 18:00:02+00:00
State: open

My server is running Wordpress 3.2.1.
The following code:

from wordpress_xmlrpc import Client
wp = Client('', '', '')

results in the exception:

Traceback (most recent call last):
File "test.py", line 2, in
wp = Client('', '', '')
File "/home/pafcu/projects/rsswp/wordpress_xmlrpc/base.py", line 24, in __init__
self.supported_methods = self.server.mt.supportedMethods()
File "/usr/lib/python2.7/xmlrpclib.py", line 1224, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.7/xmlrpclib.py", line 1570, in __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)
xml.parsers.expat.ExpatError: XML or text declaration not at start of entity: line 2, column 0

It seems like the library has trouble with the whitespace at the beginning of the reply from the server.