cos: "Integer Required"?!?!?!?
Fredrik Lundh
fredrik at pythonware.com
Thu Jun 8 11:48:12 EDT 2006
moonman wrote:
> print self.ACphi, type(self.ACphi) yields:
> 19412557 <type 'int'>
>
> value = XPLMGetDataf(self.ACphi); print value type(value ) yields:
> -0.674469709396 <type 'float'>
>
> print math.radians(XPLMGetDataf(self.ACphi)),
> type(math.radians(XPLMGetDataf(self.ACphi))) yields:
>
> TypeError
> :
> an integer is required
>
> Am I totally missing something about 'math'. Does it really expect an
> int?
nope.
>>> import math
>>> math.radians(-0.6744)
-0.011770500475449759
>>> math.cos(-0.1177)
0.99308134771019019
when you end up with exceptions that make no sense at all, and C
extensions are involved, the problem is quite often that some code in
the extension forgets to check for errors, or forgets to reset the
exception status when it has handled an error.
do you get any further if you do:
value = XPLMGetDataf(self.ACphi)
hasattr(value, "foo") # reset the exception status
print math.radians(value)
?
</F>
More information about the Python-list
mailing list