[Python Wpg] Fwd: Cannot figure out this ZeroDivisionError exception
Kevin Veroneau
kveroneau at gmail.com
Sat Mar 12 15:54:53 EST 2011
Thank you all for your help. I do believe that is what is causing the
problem. It runs now without throwing the exception.
On Fri, Mar 11, 2011 at 11:30 PM, Mike pfaiffer <high.res.mike at gmail.com>wrote:
> On 11-03-11 7:22 PM, Chris Macksey wrote:
>
>> On 11 March 2011 18:38, Mike pfaiffer<high.res.mike at gmail.com> wrote:
>>
>>
>>> Just a thought. Would scale = 1/300 not produce 0 instead of the
>>> floating point 0.00333? It looks like you may have a data type conversion
>>> issue. If the numerator is an integer then the result of the division
>>> will
>>> be an integer. I was caught by this a couple of times (and will no doubt
>>> be
>>> caught by it again in the future).
>>>
>>> Later
>>> Mike
>>>
>>>
>>>
>> Yes, it would, depending on your Python version - unless you either use
>> from
>> __future__ import division to get the new division semantics, or use
>> 1.0/300 (or equivalent) to force it to be a float.
>>
>> Cheers,
>>
>> Chris.
>>
>
> That's the way it worked out on my Mac. I couldn't test it on my
> Linux box because of hardware issues.
>
> Later
> Mike
>
>
> _______________________________________________
> Winnipeg Python Users Group mailing list
> http://WinniPUG.ca
> Winnipeg at python.org
> http://mail.python.org/mailman/listinfo/winnipeg
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/winnipeg/attachments/20110312/0a21213b/attachment.html>
More information about the Winnipeg
mailing list