Extention Woes

Tuvas tuvas21 at gmail.com
Thu Oct 20 05:09:48 CEST 2005


I tried Ctypes, but it was giving me tons of problems in the install
phase, and so I decided it'd just be better to use an extention module.
It's the type of stuff that could be perfectly done with ctypes, but...
Oh well. Also, I've done all but this last little piece with
extentions, might as well finish it.

Exact stuff.
C Code (Just parsing and printing)

        if(!PyArg_ParseTuple(args,"iiz#",&can_han,&com,&dat,&len))
                return NULL;            //This command will translate
python data to C data
        printf("%i com->%i len->%i string->%s\n",can_han,com,len,dat);

Python (Just command to this function)
print write_can(can_han,0x0140,'abcd')

Output
135769704 com->0 len->4 string->t=Ø·

Output expected values for length and the number, not for the string
nor com. Ideas?




More information about the Python-list mailing list