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

Discussion in 'Python' started by Vitaliy, May 29, 2008.

  1. Vitaliy

    Vitaliy Guest

    Hi

    I got this wired exception periodically (Python 2.5, Django based
    application)
    what does it mean ?
     
    Vitaliy, May 29, 2008
    #1
    1. Advertisements

  2. Vitaliy

    Peter Otten Guest

    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
     
    Peter Otten, May 29, 2008
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dan C Douglas
    Replies:
    5
    Views:
    656
    Dan C Douglas
    Jul 22, 2003
  2. =?Utf-8?B?SlJPQ2FtYXJv?=
    Replies:
    6
    Views:
    4,591
  3. Replies:
    0
    Views:
    10,656
  4. JavaQueries
    Replies:
    1
    Views:
    4,065
    John C. Bollinger
    Mar 1, 2005
  5. =?Utf-8?B?V2VlIEt1YW4=?=
    Replies:
    0
    Views:
    3,262
    =?Utf-8?B?V2VlIEt1YW4=?=
    Nov 20, 2006
  6. baumann@pan

    printf("%#04x\n", 0); print 0000 not 0x00

    baumann@pan, Jul 1, 2005, in forum: C Programming
    Replies:
    8
    Views:
    814
    Lawrence Kirby
    Jul 4, 2005
  7. Tomás

    Zero always == 0000 0000

    Tomás, Mar 5, 2006, in forum: C++
    Replies:
    15
    Views:
    800
    Tomás
    Mar 8, 2006
  8. valpa
    Replies:
    11
    Views:
    2,305
    Steven D'Aprano
    Mar 24, 2009
Loading...