Doesn't know what it wants

John Machin sjmachin at lexicon.net
Sat Jan 26 07:41:32 CET 2008


On Jan 26, 4:20 pm, Tim Rau <bladedpeng... at gmail.com> wrote:
> Traceback (most recent call last):
>   File "C:\Documents and Settings\Owner\My Documents\NIm's code\sandbox
> \sandbox.py", line 242, in <module>
>     player = ship()
>   File "C:\Documents and Settings\Owner\My Documents\NIm's code\sandbox
> \sandbox.py", line 121, in __init__
>     self.phyInit()
>   File "C:\Documents and Settings\Owner\My Documents\NIm's code\sandbox
> \sandbox.py", line 147, in phyInit
>     moi = cp.cpMomentForCircle(self.mass, .2, 0, vec2d((0,0)))
> ArgumentError: argument 4: <type 'exceptions.TypeError'>: expected
> vec2d instance instead of vec2d
>
> As far as I can tell, It's getting a vec2d, and it wants a vec2d. I't
> seems like it doesn't know what it wants, but I thought only teenagers
> did that, no programming languages.

It possibly means that it is expecting an instance of a class whose
name is "vec2d"  but you have given it an instance of some *other*
class whose name just happens to be "vec2d".

> clearly, Im missing something.

Yes, some information:
1. what is vec2d, class or function?
2. what do you believe vec2d((0, 0)) should return?
3. what is this belief based on?
4. what has it actually returned this time?
5. what do you believe that cp.cpMomentForCircle expects as argument
4?
6. what is this belief based on?

The ArgumentError exception is raised by ctypes "when a foreign
function call cannot convert one of the passed arguments". Based on
guessin'n'googlin' the cp thing is a set of Python bindings to a
library written in C++ ... have you considered asking the author of
the bindings?



More information about the Python-list mailing list