[New-bugs-announce] [issue7814] SimpleXMLRPCServer Example uses "mul" instead of "div" in client portion

Michael Newman report at bugs.python.org
Sat Jan 30 17:23:40 CET 2010


New submission from Michael Newman <michael.b.newman at gmail.com>:

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']

----------
assignee: georg.brandl
components: Documentation
messages: 98567
nosy: georg.brandl, mnewman
severity: normal
status: open
title: SimpleXMLRPCServer Example uses "mul" instead of "div" in client portion
versions: Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7814>
_______________________________________


More information about the New-bugs-announce mailing list