Error: Cannot convert Decimal("0.0000") to Decimal

Peter Otten __peter__ at web.de
Thu May 29 06:36:49 EDT 2008


Vitaliy wrote:

> I got this wired exception periodically (Python 2.5, Django based
> application)
> what does it mean ?

A reload() maybe?

>>> import decimal
>>> d = decimal.Decimal()
>>> reload(decimal)
<module 'decimal' from '/usr/lib/python2.5/decimal.pyc'>
>>> decimal.Decimal(d)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/decimal.py", line 617, in __new__
    raise TypeError("Cannot convert %r to Decimal" % value)
TypeError: Cannot convert Decimal("0") to Decimal

Peter



More information about the Python-list mailing list