开发者

Seeing exceptions from methods registered to SimpleXMLRPCServer

I'm writing an xmlrpc-based python 2.7 program, using SimpleX开发者_JAVA技巧MLRPCServer. I import the class with all our logic and register it with:

server = SimpleXMLRPCServer(("0.0.0.0", 9001))
server.register_instancce(classWithAllTheLogic())
server.serve_forever()

When running this in console I can see the log messages from SimpleXMLRPCServer about what messages are being sent, but all of the debug information from methods within classWithAllTheLogic() seems to be surpressed. If a method throws an exception there, I don't see any error message in console, and the xmlrpc call bound to that method just silently fails. print statements within the classWithAllTheLogic methods also just don't show up. What's going on here?


I am unable to reproduce this. Test script test.py

from xmlrpc.server import SimpleXMLRPCServer
class classWithAllTheLogic:
    def __init__(self):
        print("Hi")
        raise Exception("INIT Exception")

    def hello(self):
        print("hello")
        raise Exception("Hello Exception")

server = SimpleXMLRPCServer(("0.0.0.0", 9001))
server.register_instance(classWithAllTheLogic())
server.serve_forever()

Run:

E:\tmp>python test.py
Hi
Traceback (most recent call last):
  File "test.py", line 13, in <module>
    server.register_instance(classWithAllTheLogic())
  File "test.py", line 6, in __init__
    raise Exception("INIT Exception")
Exception: INIT Exception

E:\tmp>

?!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜