Extention Woes

Fredrik Lundh fredrik at pythonware.com
Wed Oct 19 16:30:05 EDT 2005


"Tuvas" wrote:

> I am in the process of writing an extention module, and am coming up
> with lots of problems. Perhaps someone could be of use. I keep getting
> data that isn't what I'm sending the program. Let me give the line of C
> code and Python Code and output to illistrate the problem.
>
> write_can(can_han,0x0140,'abcd')
>
> if (PyArg_ParseTuple(args("iiz#",&can_han,&com,&data,&len)
>     return NULL;

that doesn't look entirely correct.  maybe you should switch to a com-
puter with working cut and paste, so we don't have to guess...

> Okay, so I put in a print statement to print out the variables can_han,
> com, data, and length. The results were more or less this (I don't have
> copy/paste at the moment, so...
>
> 1357 com->0 len->4 str->,/p.
>
> Anways, the variable can_han was correct, the length is correct, but
> the com and the string are garbage. Any ideas as to why this may be?

it would help if you included the variable declarations and the exact printf
statement you used to print them.

</F>






More information about the Python-list mailing list