Note that there are some explanatory texts on larger screens.

plurals
  1. POTwisted XML-RPC error
    text
    copied!<p>I get an exception on both client and server side when I run the first example at <a href="http://buildbot.twistedmatrix.com/builds/sphinx-html/291-15849/projects/web/howto/xmlrpc.html" rel="nofollow">http://buildbot.twistedmatrix.com/builds/sphinx-html/291-15849/projects/web/howto/xmlrpc.html</a>. The server code I used is below:</p> <pre><code>from twisted.web import xmlrpc, server class Example(xmlrpc.XMLRPC): """An example object to be published.""" def xmlrpc_echo(self, x): """ Return all passed args. """ return x def xmlrpc_add(self, a, b): """ Return sum of arguments. """ return a + b def xmlrpc_fault(self): """ Raise a Fault indicating that the procedure should not be used. """ raise xmlrpc.Fault(123, "The fault procedure is faulty.") if __name__ == '__main__': from twisted.internet import reactor r = Example() reactor.listenTCP(7080, server.Site(r)) reactor.run() </code></pre> <p>Client side is below:</p> <pre><code>import xmlrpclib s = xmlrpclib.Server('http://localhost:7080/') print s.echo('Hello world') </code></pre> <p>The server side exception is:</p> <pre><code>Traceback (most recent call last): File "/usr/lib/python2.6/dist-packages/twisted/web/xmlrpc.py", line 150, in render_POST d.addCallback(self._cbRender, request, responseFailed) File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 260, in addCallback callbackKeywords=kw) File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 249, in addCallbacks self._runCallbacks() File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 441, in _runCallbacks self.result = callback(self.result, *args, **kw) --- &lt;exception caught here&gt; --- File "/usr/lib/python2.6/dist-packages/twisted/web/xmlrpc.py", line 170, in _cbRender allow_none=self.allowNone) exceptions.TypeError: dumps() got an unexpected keyword argument 'allow_none' </code></pre> <p>Client side exception is:</p> <pre><code>Traceback (most recent call last): File "./client.py", line 6, in &lt;module&gt; print s.echo('Hello world') File "/usr/local/lib/python2.6/dist-packages/xmlrpclib-1.0.1-py2.6.egg/xmlrpclib.py", line 986, in __call__ return self.__send(self.__name, args) File "/usr/local/lib/python2.6/dist-packages/xmlrpclib-1.0.1-py2.6.egg/xmlrpclib.py", line 1239, in __request verbose=self.__verbose File "/usr/local/lib/python2.6/dist-packages/xmlrpclib-1.0.1-py2.6.egg/xmlrpclib.py", line 1037, in request return self._parse_response(h.getfile(), sock) File "/usr/local/lib/python2.6/dist-packages/xmlrpclib-1.0.1-py2.6.egg/xmlrpclib.py", line 1136, in _parse_response p.close() File "/usr/local/lib/python2.6/dist-packages/xmlrpclib-1.0.1-py2.6.egg/xmlrpclib.py", line 508, in close self._parser.Parse("", 1) # end of data xml.parsers.expat.ExpatError: no element found: line 1, column 0 </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload