Newbie question

Geirr hmcy2002 at yahoo.co.uk
Tue Oct 25 12:22:12 EDT 2005


Hi, ive just started playing around with python and wondered if someone
could poing me in the right way here.


I have a xmlrpc server simple script:

Server script:
import SimpleXMLRPCServer
class tpo:

	def retTPOXML():
		theFile=open('tpo.xml')
		try:
			self.strXML = theFile.read()
			return self.strXML
		finally:
			theFile.close()

tpo_object = tpo()
server = SimpleXMLRPCServer.SimpleXMLRPCServer(("localhost",8888))
server.register_instance(tpo_object)

print "Listening on port 8888"
server.serve_forever()

and im trying to print the return value with any luck

Client Code:
import xmlrpclib
server = xmlrpclib.ServerProxy("http://localhost:8888")
current = server.retTPOXML
print current


Any comment would be appriciated




More information about the Python-list mailing list