Re: Simple CGI-XMLRPC failure

2009-01-13 Thread Mike MacHenry
I figured it was some kind of bug. Must be either a bug with my
version of either the library (most likely) or perhaps some weird
environment setting that I have set incorrectly (also likely). How can
I figure out which version of SimpleXMLRPCServer I'm running? Do you
run Ubuntu by any chance? If you which version?

Does anyone know of any environment settings I could look into on
Apache or Python?

-mike

On Mon, Jan 12, 2009 at 9:02 PM, Jeff McNeil j...@jmcneil.net wrote:
 On Jan 12, 12:40 pm, Mike MacHenry dski...@ccs.neu.edu wrote:
 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/roundwarerpc.py
 from SimpleXMLRPCServer import CGIXMLRPCRequestHandler
 def i(x):
 return x
 server = CGIXMLRPCRequestHandler()
 server.register_function(pow)
 server.register_function(i)
 server.handle_request()

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

 #This is the STDOUT and STDERR when running ~/test.py
 dski...@dskippy-laptop:$ python test.py 8
 Traceback (most recent call last):
   File test.py, line 4, in module
 print server.test(10)
   File /usr/lib/python2.5/xmlrpclib.py, line 1147, in __call__
 return self.__send(self.__name, args)
   File /usr/lib/python2.5/xmlrpclib.py, line 1437, in __request
 verbose=self.__verbose
   File /usr/lib/python2.5/xmlrpclib.py, line 1201, in request
 return self._parse_response(h.getfile(), sock)
   File /usr/lib/python2.5/xmlrpclib.py, line 1340, in _parse_response
 return u.close()
   File /usr/lib/python2.5/xmlrpclib.py, 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,
 -mike

 p.s.
 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

 I copied your code verbatim and I don't have any issues with it at
 all. Same version of Python, same version of Apache.

 In SimpleXMLRPCServer.py, register_function adds directly to a
 self.funcs dictionary, so an instance variable of the same name
 shouldn't hurt anything.  That exception is only raised when a
 self.funcs lookup raises a KeyError unless you're registering an
 instance.

 --
 http://mail.python.org/mailman/listinfo/python-list

--
http://mail.python.org/mailman/listinfo/python-list


Simple CGI-XMLRPC failure

2009-01-12 Thread Mike MacHenry
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/roundwarerpc.py
from SimpleXMLRPCServer import CGIXMLRPCRequestHandler
def i(x):
return x
server = CGIXMLRPCRequestHandler()
server.register_function(pow)
server.register_function(i)
server.handle_request()


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

#This is the STDOUT and STDERR when running ~/test.py
dski...@dskippy-laptop:$ python test.py 8
Traceback (most recent call last):
  File test.py, line 4, in module
print server.test(10)
  File /usr/lib/python2.5/xmlrpclib.py, line 1147, in __call__
return self.__send(self.__name, args)
  File /usr/lib/python2.5/xmlrpclib.py, line 1437, in __request
verbose=self.__verbose
  File /usr/lib/python2.5/xmlrpclib.py, line 1201, in request
return self._parse_response(h.getfile(), sock)
  File /usr/lib/python2.5/xmlrpclib.py, line 1340, in _parse_response
return u.close()
  File /usr/lib/python2.5/xmlrpclib.py, 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,
-mike

p.s.
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
--
http://mail.python.org/mailman/listinfo/python-list