How to Catch Errors in SimpleXMLRPCServer

gregpinero at gmail.com gregpinero at gmail.com
Thu Sep 27 16:55:33 EDT 2007


On Sep 27, 3:55 pm, "Jeff McNeil" <j... at jmcneil.net> wrote:
> Instead of register_function, use register_instance and provide a
> _dispatch method in that instance that handles your exception logging.
>
> Pseudo:
>
> class MyCalls(object):
>     def _dispatch(self, method, args):
>         try:
>             self.getattr(self, method)(*args)
>         except:
>             handle_logging()
>
> server = SimpleXMLRPCServer(("localhost", 8000))
> server.register_instance(MyCalls())
> server.serve_forever()
>
> There might be an easier way... but this works for me.

I wonder if there is something wrong with that.  I get this error on
calling ever method:

Fault 1: 'exceptions.TypeError:cannot marshal None unless allow_none
is enabled' but I can't see anywhere None would be coming from.

-Greg





More information about the Python-list mailing list