SystemError: new style getargs format but argument is not a tuple

2007-02-26 Thread zefciu
I am trying to embed a c function in my python script for a first time. When I try to call it I get an error SystemError: new style getargs format but argument is not a tuple Guido said on some mailing list, that it is probably an effect of the lack of METH_VARARGS in the functions' array

Re: SystemError: new style getargs format but argument is not a tuple

2007-02-26 Thread Thinker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 zefciu wrote: I am trying to embed a c function in my python script for a first time. When I try to call it I get an error SystemError: new style getargs format but argument is not a tuple Guido said on some mailing list, that it is probably

Re: SystemError: new style getargs format but argument is not a tuple

2007-02-26 Thread zefciu
Thinker wrote: zefciu wrote: I am trying to embed a c function in my python script for a first time. When I try to call it I get an error SystemError: new style getargs format but argument is not a tuple Guido said on some mailing list, that it is probably an effect of the lack

Re: SystemError: new style getargs format but argument is not a tuple

2007-02-26 Thread Thinker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 zefciu wrote: I am trying to embed a c function in my python script for a first time. When I try to call it I get an error SystemError: new style getargs format but argument is not a tuple Guido said on some mailing list, that it is probably

Re: SystemError: new style getargs format but argument is not a tuple

2007-02-26 Thread zefciu
Thinker wrote: It should be PyObject *coord; . Maybe, it is what is wrong with your program! Should it? The gcc shows me a warning then: warning: 'coord' is used uninitialized in this function and during the execution I get the same error *plus* a segfault. zefciu --

Re: SystemError: new style getargs format but argument is not a tuple

2007-02-26 Thread Thinker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 zefciu wrote: Thinker wrote: It should be PyObject *coord; . Maybe, it is what is wrong with your program! Should it? The gcc shows me a warning then: warning: 'coord' is used uninitialized in this function and during the execution I get

Re: SystemError: new style getargs format but argument is not a tuple

2007-02-26 Thread zefciu
Thinker wrote: You can add some printf() to throw out messages to make sure where the program stop at. If you can compile the module with debug information and use gdb to backtrace dump file, it would be useful. Did it. The arguments are parsed, but the coord tuple isn't. But can

Re: SystemError: new style getargs format but argument is not a tuple

2007-02-26 Thread Thinker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 zefciu wrote: Thinker wrote: You can add some printf() to throw out messages to make sure where the program stop at. If you can compile the module with debug information and use gdb to backtrace dump file, it would be useful. Did it. The

Re: SystemError: new style getargs format but argument is not a tuple

2007-02-26 Thread zefciu
Thinker wrote: Since PyArg_ParseTuple() is supposed to parse arguments, I recommand you to use PyTuple_GetItem() or PyTuple_GET_ITEM(). Ok. Now I do it this way: c_real = PyFloat_AsDouble(PyTuple_GetItem(coord,0)); c_imag = PyFloat_AsDouble(PyTuple_GetItem(coord,1)); And it worked... once.

Re: SystemError: new style getargs format but argument is not a tuple

2007-02-26 Thread Thinker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 zefciu wrote: Thinker wrote: Since PyArg_ParseTuple() is supposed to parse arguments, I recommand you to use PyTuple_GetItem() or PyTuple_GET_ITEM(). Ok. Now I do it this way: c_real = PyFloat_AsDouble(PyTuple_GetItem(coord,0)); c_imag =

Re: SystemError: new style getargs format but argument is not a tuple

2007-02-26 Thread Ziga Seilnacht
zefciu wrote: Ok. Now I do it this way: c_real = PyFloat_AsDouble(PyTuple_GetItem(coord,0)); c_imag = PyFloat_AsDouble(PyTuple_GetItem(coord,1)); And it worked... once. The problem is really funny - in the interactive the function fails every second time. mandelpixel((1.5, 1.5), 9,

Re: SystemError: new style getargs format but argument is not a tuple

2007-02-26 Thread zefciu
Ziga Seilnacht wrote: The second example uses your approach and is a bit more cumbersome, but still works. Could you post your current version of the code? I don't understand where your problem could be. I think, there's no need to. Now I understand :) if (!PyArg_ParseTuple(args, Oid,