Skip to content

ExpatError: XML or text declaration not at start of entity #12

@pafcu

Description

@pafcu

My server is running Wordpress 3.2.1.
The following code:

from wordpress_xmlrpc import Client
wp = Client('<redacted>', '<redacted>', '<redacted>')

results in the exception:

Traceback (most recent call last):
  File "test.py", line 2, in <module>
    wp = Client('<redacted>', '<redacted>', '<redacted>')
  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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions