[python-chinese] �c�չPython�������㬵�������DLE�� ����ͬ������IDLE��ug
cry
zyqmail在tom.com
星期五 九月 1 17:47:21 HKT 2006
Wayne,您好!
我只在命令行下调试,省了一些莫名其妙的问题。
在 2006-09-01 17:11:00 您写道:
>程序如下:
>
>//mian.c
>#include<stdio.h>
>void rawprint(char *string)
>{
> printf("%s\n",string);
>}
>
>//wrap.c
>#include<python.h>
>extern void rawprint(char*);
>
>PyObject *testex_rawprint(PyObject *self,PyObject *args)
>{
> char *string;
> if( !PyArg_ParseTuple(args,"s",&string) ){
> return NULL;
> }
> rawprint(string);
> Py_INCREF(Py_None);
> return Py_None;
>}
>
>static PyMethodDef testexmethods[] = {
> {"rawprint", testex_rawprint,METH_VARARGS,"print a raw string"},
> {NULL,NULL},
>};
>
>void inittestex(void)
>{
> Py_InitModule("testex",testexmethods);
>}
>
>然后用命令
>gcc -shared -I"c:\Python24\include" -L"c:\Python24\libs" *c -lpython24 -o t
>estex.dll
>生成动态链接库并复制到c:\Python24目录下。
>
>在IDLE下:
>>>> import testex
>>>> testex.rawprint('hello')
>>>>
>没有打出hello
>
>在命令行下就可以打出hello
>
>原以为是程序的问题,改了多次还是不行。开始怀疑是IDLE的bug,换用Wing IDE,可以打出hello。
>faint,令人郁闷的IDLE啊
>--
>温铭
>welcome to my blog : http://blog.csdn.net/wayne92
>_______________________________________________
>python-chinese
>Post: send python-chinese在lists.python.cn
>Subscribe: send subscribe to python-chinese-request在lists.python.cn
>Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn
>Detail Info: http://python.cn/mailman/listinfo/python-chinese
致
礼!
cry
zyqmail在tom.com
关于邮件列表 python-chinese 的更多信息