Doesn't know what it wants

Tim Rau bladedpenguin at gmail.com
Sat Jan 26 07:52:58 CET 2008


On Jan 26, 1:41 am, John Machin <sjmac... at lexicon.net> wrote:
> 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?

1. vec2d is a class, designed to hold and manipulte 2d vectors
2. it should return a vector with x=0 and y=0
3. That's what it's done before.
4. trying it in the interpreter seems to show that it returns a vec2d
with zero length. as it should.
5.cp.cpMomentForCircle seems to expect a vec2d. I'm baseing that on a
functioning demo that uses the exact same line.

I guess that the vec2d I've got is not the one it wants. How do I tell
the difference? I'll go look at all the imports.



More information about the Python-list mailing list