← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #226713]: How to create an instance of an inherited class in unittest Python so that I can register the instance of that class in simpleXMLRPCServer

 

Question #226713 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/226713

    Status: Open => Answered

RaiMan proposed the following answer:
this works as documented and hence expected:

# -------- server
from SimpleXMLRPCServer import SimpleXMLRPCServer
server = SimpleXMLRPCServer(("localhost", 8000))

def hallo(): popup("hallo"); return 0

class Hallo():
    def hallo1(self): popup("hallo1"); return 0
   
server.register_function(hallo)
server.register_instance(Hallo())

print "server should run"
server.serve_forever()

# ----------  client
import xmlrpclib
c = xmlrpclib.ServerProxy('http://localhost:8000')

c.hallo()
c.hallo1()

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.