[Twisted-Python] problem accessing numeric datatype of postgresql in a twisted application

Jean-Paul Calderone exarkun at divmod.com
Tue May 5 09:14:18 EDT 2009

On Tue, 05 May 2009 18:40:29 +0530, Krishnakant <hackingkk at gmail.com> wrote:
>On Tue, 2009-05-05 at 13:53 +0200, Thomas Hervé wrote:
>> We're missing some information to help you. What's doing your Twisted
>> application? By itself Twisted doesn't serialize anything, so you're
>> probably using pb or xmlrpc?
>Yes, I am using xmlrpc in my twisted server.
>the server sends queries to a postgresql database.  and there are
>situations where data from a numeric datatype is selected and returned
>to the calling xmlrpc function.
>such as xmlrpc_getVender(vendercode) ...
>When a field with datatype numeric is involved my xmlrpc server
>application says "can't serialise object ".

It sounds like your database API is giving you objects of a type which is
not supported by XML-RPC.  Twisted's XML-RPC server is based on the standard
xmlrpclib module, which can only serialize simple types - int, str, etc.  If
you have a custom pgsql-specific numeric type, you need to convert it before
giving it back to the XML-RPC code.


More information about the Twisted-Python mailing list