Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Error: Cannot convert Decimal("0.0000") to Decimal

Reply
Thread Tools

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

 
 
Vitaliy
Guest
Posts: n/a
 
      05-29-2008
Hi

I got this wired exception periodically (Python 2.5, Django based
application)
what does it mean ?
 
Reply With Quote
 
 
 
 
Peter Otten
Guest
Posts: n/a
 
      05-29-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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Value of type Decimal cannot be converted to 1 dimensional array of Decimal Neal Software 0 03-20-2011 03:08 AM
decimal.Decimal formatting python@lists.fastmail.net Python 0 07-19-2010 12:32 PM
how to convert from Decimal('1.23456789') to Decimal('1.234') valpa Python 11 03-24-2009 07:11 AM
TypeError: unsupported operand type(s) for -: 'Decimal' and 'Decimal'. Why? Gilbert Fine Python 8 08-01-2007 01:58 AM
Decimal to Packed Decimal Conversion in C++ Ven C++ 3 08-01-2006 03:56 PM



Advertisments