Cannot marshal <class 'decimal.Decimal'> objects

D'Arcy Cain darcy at VybeNetworks.com
Fri Nov 27 14:37:52 EST 2020


I am getting this error.  I found this recipe to fix it:

from xmlrpclib import Marshaller
from decimal import Decimal

def dump_decimal(self, value, write):
      write("<value><double>")
      write(str(value))
      write("</double></value>\n")

Marshaller.dispatch[Decimal] = dump_decimal

That seems to be for Python 2.  I am running Python 3.5 (I know but I am 
stuck there for the moment).  I tried changing the import to "from 
xmlrpcl.client import Marshaller" which didn't raise an error but the 
problem still persists.  Do I need to do something different for Python 3?

TIA.

-- 
D'Arcy J.M. Cain
Vybe Networks Inc.
A unit of Excelsior Solutions Corporation - Propelling Business Forward
http://www.VybeNetworks.com/
IM:darcy at VybeNetworks.com VoIP: sip:darcy at VybeNetworks.com


-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 236 bytes
Desc: OpenPGP digital signature
URL: <https://mail.python.org/pipermail/python-list/attachments/20201127/60bb2ee8/attachment.sig>


More information about the Python-list mailing list