cos: "Integer Required"?!?!?!?

moonman iant at the-wire.com
Thu Jun 8 11:31:25 EDT 2006


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?


Moonman

Larry Bates wrote:
> First: Always post cut-paste tracebacks so we can see actual
> error message.
>
> Second: print out self.ACphi, XPLMGetDataf(self.ACphi) and
> math.radians(XPLMGetDataf(self.ACphi)) before this statement
> and you will find the problem.
>
> -Larry Bates
>
>
> moonman wrote:
> > Hello all,
> >
> > I've just jumped into Python trying to develop X-Plane plugins.
> >
> > All was chugging along well until I tried to use math.cos()
> >
> > snippet:
> >
> > import math
> >
> > ....
> >
> > cos_phi = math.cos(math.radians(XPLMGetDataf(self.ACphi))) # Error
> > occurs here
> >
> >
> >
> > Now XPLMGetDataf should be returning float.
> >
> > Is there something that I'm completely missing about how Python does
> > tyonig or something?
> > 
> > Thanks in advance,
> > 
> > Moonman
> >




More information about the Python-list mailing list