Simple CGI-XMLRPC failure

Mike MacHenry dskippy at
Mon Jan 12 18:40:57 CET 2009

I am having a difficult time understanding why my very simple
CGI-XMLRPC test isn't working. I created a server to export two
functions, the built-in function "pow" and my own identity function
"i". I run a script to call both of them and the "pow" work fine but
the "i" gives me an error that says my XMLRPC server doesn't support
than name. Here is the code for both files and the output:

#!/usr/bin/env python
#This file is /usr/lib/cgi-bin/
from SimpleXMLRPCServer import CGIXMLRPCRequestHandler
def i(x):
        return x
server = CGIXMLRPCRequestHandler()

#!/usr/bin/env python
#This file is ~/
import xmlrpclib
server = xmlrpclib.ServerProxy("http://localhost/cgi-bin/")
print server.pow(2,3)
print server.i(10)

#This is the STDOUT and STDERR when running ~/
dskippy at dskippy-laptop:$ python 8
Traceback (most recent call last):
  File "", line 4, in <module>
    print server.test(10)
  File "/usr/lib/python2.5/", line 1147, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.5/", line 1437, in __request
  File "/usr/lib/python2.5/", line 1201, in request
    return self._parse_response(h.getfile(), sock)
  File "/usr/lib/python2.5/", line 1340, in _parse_response
    return u.close()
  File "/usr/lib/python2.5/", line 787, in close
    raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 1: '<type \'exceptions.Exception\'>:method "i"
is not supported'>

Does anyone know what might be wrong with this?

Thanks for the help,

Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Server version Apache/2.2.8 (Ubuntu)
Server built: Jun 25 2008 13:54:13

More information about the Python-list mailing list