[Twisted-Python] xmlrpc ExpatError

Justin Johnson justinjohnson at fastmail.fm
Wed Jun 18 10:28:56 EDT 2003


Hello,

I have an xmlrpc server using twisted.web.xmlrpc.XMLRPC.  I have been
able to contect to it fine using just python's xmlrpclib on the client,
and am now switching over to use twisted on the client as well.  I'm
getting a wierd error though that I'm not sure how to track down.  Below
is are snippets of my client code, server code, and the error I'm
getting.

Any help you can provide is appreciated.
-Justin


[client]
def connectToServer(server):
	s = Proxy('http://%s:%s' % (server, config.portNumber))
	return s

def printValue(output):
	print "success"
	#print "success: %s" % output
	reactor.stop()

def printError(output):
	print "error"
	#print "error: %s" % output
	reactor.stop()

# Subcommand: mkvob
def doMkvob(options):
	vobs = options["vobs"].split(",")
	original_site = options["original"]
	group = options["group"]

	s = connectToServer(config.siteToServer[original_site])
	print "Successfully connected to %s (%s)." % (original_site, config.siteToServer[original_site])
	print "Calling remote mkvob ..."

	d = s.callRemote('mkvob', vobs, group).addCallbacks(printValue, printError)
	reactor.run()
[/client]

[server]
class CCService(xmlrpc.XMLRPC):
	"""Service for handling remote VOB creation, removal, and general
	   ClearCase maintenance.
	"""

	def xmlrpc_mkvob(self, vobs, group):
		"""Create VOBs and apply standard triggers.
		"""
		log("we're in")
		output = ""
		rtn = SUCCESS
		for tag in vobs:
			log("Start mkvob for VOB '%s'" % tag)
			vob = VOB(tag, group)
			try:
				output += vob.make()
				output += vob.applyTriggers()
			except errors.CmdError, e:
				rtn = FAILURE
				output = e.stdout + e.stderr
				log("Error raised: cmd=%s, status=%s, stdout=%s, stderr=%s" % (e.cmd, e.status, e.stdout, e.stderr))
			log("End mkvob for VOB '%s'" % tag)
		return (rtn, output)
[/server]


Traceback (most recent call last):
  File "E:\Python22\Lib\site-packages\twisted\protocols\basic.py", line
  173, in
dataReceived
    self.lineReceived(line)
  File "E:\Python22\Lib\site-packages\twisted\protocols\http.py", line
  893, in l
ineReceived
    self.allContentReceived()
  File "E:\Python22\Lib\site-packages\twisted\protocols\http.py", line
  932, in a
llContentReceived
    req.requestReceived(command, path, version)
  File "E:\Python22\Lib\site-packages\twisted\protocols\http.py", line
  504, in r
equestReceived
    self.process()
--- <exception caught here> ---
  File "E:\Python22\Lib\site-packages\twisted\web\server.py", line 156,
  in proce
ss
    self.render(resrc)
  File "E:\Python22\Lib\site-packages\twisted\web\server.py", line 162,
  in rende
r
    body = resrc.render(self)
  File "E:\Python22\Lib\site-packages\twisted\web\xmlrpc.py", line 103,
  in rende
r
    args, functionPath = xmlrpclib.loads(request.content.read())
  File "E:\Python22\lib\xmlrpclib.py", line 805, in loads
    p.close()
  File "E:\Python22\lib\xmlrpclib.py", line 393, in close
    self._parser.Parse("", 1) # end of data
xml.parsers.expat.ExpatError: no element found: line 1, column 0




More information about the Twisted-Python mailing list