[Twisted-Python] adbapi results through xmlrpc

Zach Thompson lists at allotropic.com
Wed Mar 31 14:08:09 MST 2004


Hello,

I'm trying to connect 2 scripts (a server and client) xmlrpc.  The 
server just needs to run a db query and return the result set to the 
client for display.  Here's part of the server class:

     def xmlrpc_get_count(self):
         from twisted.enterprise import adbapi
         pool = adbapi.ConnectionPool("pyPgSQL.PgSQL", database="zach")
         return pool.runQuery("select count(*) from asdf")

And part of the client class:

     def OnButton(self, event):
         from twisted.web.xmlrpc import Proxy
         proxy = Proxy("http://localhost:8080")
         proxy.callRemote('get_count').addCallback(self.UpdateCount)

     def UpdateCount(self, count):
         self.label.SetLabel(count)

Here's what the client prints when I press the button:

   Unhandled error in Deferred:
   Failure: xmlrpclib.Fault: <Fault 8002: "can't serialize output">

I can understand that xmlrpc needs to serialize the Deferred object to 
send it through http.  I'm guessing there's a reference to the 
ConnectionPool object contained in the Deferred, and it makes sense 
that you wouldn't be able to serialize something like that.

Any ideas?

BTW, the client is running on a wxreactor, if that matters..

Thanks,
Zach
  





More information about the Twisted-Python mailing list