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

2006-06-08 Thread moonman
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

-- 
http://mail.python.org/mailman/listinfo/python-list


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

2006-06-08 Thread moonman

print self.ACphi, type(self.ACphi) yields:
19412557 

value = XPLMGetDataf(self.ACphi); print value  type(value ) yields:
-0.674469709396 

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
> >

-- 
http://mail.python.org/mailman/listinfo/python-list


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

2006-06-08 Thread moonman
I'm using ActiveState PythonV2.4.1

I'm certainly not affecting 'math'. I wonder if the XPlane SDK Python
binding is touching anything.

I'll download the latest ActiveState Python and keep on plugging.

Thanks!


Mikael Olofsson wrote:
> moonman wrote:
> > print self.ACphi, type(self.ACphi) yields:
> > 19412557 
> >
> > value = XPLMGetDataf(self.ACphi); print value  type(value ) yields:
> > -0.674469709396 
> >
> > 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?
>
> Not my Python:
>
>  >>> math.radians(-0.674469709396)
> -0.011771717133929535
>
> This all seems very confusing. Have you tried exactly the above?
>
> Do you perhaps have a module of your own called math, that Python might
> be importing? Or is your math not a module, but some other object that
> happens to have a method called radians, that expects an int? Or have
> you accidentally redefined math.radians?
> 
> /MiO

-- 
http://mail.python.org/mailman/listinfo/python-list


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

2006-06-14 Thread moonman
It appears that the cause of this problem was indirect.

I input something incorrect as an argument to an xplane sdk function
and the cos/integer type error followed.

Thanks for the help. The diagnostic functions I learned in this thread
will be very helpful in the future.


moonman wrote:
> I'm using ActiveState PythonV2.4.1
>
> I'm certainly not affecting 'math'. I wonder if the XPlane SDK Python
> binding is touching anything.
>
> I'll download the latest ActiveState Python and keep on plugging.
>
> Thanks!
>
>
> Mikael Olofsson wrote:
> > moonman wrote:
> > > print self.ACphi, type(self.ACphi) yields:
> > > 19412557 
> > >
> > > value = XPLMGetDataf(self.ACphi); print value  type(value ) yields:
> > > -0.674469709396 
> > >
> > > 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?
> >
> > Not my Python:
> >
> >  >>> math.radians(-0.674469709396)
> > -0.011771717133929535
> >
> > This all seems very confusing. Have you tried exactly the above?
> >
> > Do you perhaps have a module of your own called math, that Python might
> > be importing? Or is your math not a module, but some other object that
> > happens to have a method called radians, that expects an int? Or have
> > you accidentally redefined math.radians?
> > 
> > /MiO

-- 
http://mail.python.org/mailman/listinfo/python-list