In "20.24.1.1. SimpleXMLRPCServer Example":
http://docs.python.org/3.1/library/xmlrpc.server.html
The client portion of the example uses "mul", which does not exist in the server portion. The easiest fix to change the client to use "div" instead of "mul".
# Attempt to use client code exactly as provided:
# Python 3.1.1 (r311:74483) on win32
E:\notes\Programming\python3\lib\xmlrpc.server>py31 example1_xmlrpc_client.py
8
5
Traceback (most recent call last):
File "example1_xmlrpc_client.py", line 11, in <module>
print(s.mul(5,2)) # Returns 5*2 = 10
File "C:\python31\lib\xmlrpc\client.py", line 1029, in __call__
return self.__send(self.__name, args)
File "C:\python31\lib\xmlrpc\client.py", line 1271, in __request
verbose=self.__verbose
File "C:\python31\lib\xmlrpc\client.py", line 1070, in request
return self.parse_response(resp)
File "C:\python31\lib\xmlrpc\client.py", line 1169, in parse_response
return u.close()
File "C:\python31\lib\xmlrpc\client.py", line 673, in close
raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault 1: '<class \'Exception\'>:method "mul" is not supported'>
To fix it, I changed this line in the client code:
print(s.mul(5,2)) # Returns 5*2 = 10
to:
print(s.div(8,2)) # Returns 8/2 = 4
# Here's how it now looks after the suggested fix:
E:\notes\Programming\python3\lib\xmlrpc.server>py31 example1_xmlrpc_client_rev1.
py
8
5
4
['add', 'div', 'pow', 'system.listMethods', 'system.methodHelp', 'system.methodSignature']
|