[SciPy-User] TypeError

Waléria Antunes David waleriantunes at gmail.com
Thu Oct 21 09:23:56 EDT 2010


Thanks

On Thu, Oct 21, 2010 at 11:16 AM, <josef.pktd at gmail.com> wrote:

>
>
> On Thu, Oct 21, 2010 at 6:22 AM, Waléria Antunes David <
> waleriantunes at gmail.com> wrote:
>
>> Hi all,
>>
>> I have this code: http://pastebin.com/nDrisnhZ
>> and my forms.py: http://pastebin.com/wHEErcQx
>>
>> But is ocurring this error:
>>
>> TypeError at /index/
>>
>> unsupported operand type(s) for ** or pow(): 'Decimal' and 'float'
>>
>>  Request Method: POST  Request URL: http://localhost:8000/index/  Exception
>> Type: TypeError  Exception Value:
>>
>> unsupported operand type(s) for ** or pow(): 'Decimal' and 'float'
>>
>>  Exception Location: C:\supernovas_Ia\..\supernovas_Ia\supernovas\views.py
>> in index, line 19
>>
>
> as your exception says fractional powers are not supported for Decimal
> type, you need to convert/cast it
>
> >>> Decimal(532, 2)**(0.5)
> Traceback (most recent call last):
>   File "<pyshell#129>", line 1, in <module>
>     Decimal(532, 2)**(0.5)
> TypeError: unsupported operand type(s) for ** or pow(): 'Decimal' and
> 'float'
> >>> float(Decimal(532, 2))**(0.5)
> 23.065125189341593
>
> As someone mentioned before, trying it in an interpreter shell is easier.
>
> Josef
>
>
>>
>> How do i fix this?
>>
>> Thanks,
>> Waléria
>>
>> _______________________________________________
>> SciPy-User mailing list
>> SciPy-User at scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>
>>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20101021/0a29f0c8/attachment.html>


More information about the SciPy-User mailing list