xmlrpclib

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sashan

    xmlrpclib

    Hi

    I'm having trouble using xmlrpclib. I register a function (or class)
    with the SimpleXMLRPCSer ver and initiate the server. I then create a
    ServerProxy object and connect to the xml-rpc server. When I call a
    registerd function or class member function I get the follwoing error.
    I've attached the server and client source files.


    File "D:\Python23\li b\xmlrpclib.py" , line 742, in close
    raise Fault(**self._s tack[0])
    xmlrpclib.Fault : <Fault 1: 'exceptions.Typ eError:cannot marshal None
    unless allo
    w_none is enabled'>

    Thanks


    from SimpleXMLRPCSer ver import SimpleXMLRPCSer ver

    class A(object):
    def f(self):
    print 'A'

    def g():
    print 'g'

    def main():
    server = SimpleXMLRPCSer ver(("",2001))
    server.register _function(g)
    server.register _instance(A())
    server.serve_fo rever()

    if __name__ == '__main__':
    main()

    from xmlrpclib import ServerProxy

    def main():
    sp = ServerProxy('ht tp://localhost:2001' )
    print sp.f()

    if __name__ == '__main__':
    main()

Working...