Jeremy Moles wrote:
Probably what you want to do though is just keep the tuple as is and
iterate over it using the PySequence_* protocol:
http://docs.python.org/api/sequence.html
I did post a complete and tested example a few days ago, which contained
code that showed how to do this. a
Fredrik...I forgot about that...wish Google Groups had a way to quickly
find the topics a user posts.
anyhow, for receiving an object from python..is it
ok = PyArg_ParseTuple(args, sO, x, y);
...is it sO or s0 is it O (as in the letter) or 0 (as in the
number)? I would think O the
Fredrik,
...I tried using your code...
static long *get_long_array(PyObject *data, int *data_size) {
int i, size;
long* out;
PyObject* seq;
seq = PySequence_Fast(data, expected a sequence);
if (!seq)
return NULL;
size = PySequence_Size(seq);
if (size 0)
I got it. I had get_long_array placed after the method that was
calling it..
i.e.
void doStuf(...) {
x = get_long_array(...);
}
static long *get_long_array(PyObject *data, int *data_size) {
...
}
...I put get_long_array before it in my code..and its fine.
Thanks
Java and Swing wrote:
Java and Swing wrote:
and I get this error..
C:\project\myapp.c(549) : error C2040: 'get_long_array' : 'long
*(struct _object *,int *)' differs in levels of indirection from 'int
()'
so what's on line 549 in myapp.c?
what other warnings did you get from the compiler?
do you have other
Java and Swing wrote:
anyhow, for receiving an object from python..is it
ok = PyArg_ParseTuple(args, sO, x, y);
...is it sO or s0 is it O (as in the letter) or 0 (as in the
number)? I would think O the letter..but it looks like a zero.
eh? if you're not sure, what keeps you from
I have a C function which takes an array of long values..
I understand that I can pass a tuple to a C wrapper function and in the
C wrapper function have..
int ok = PyArg_ParseTuple(args, s(ll), a, b, c);
..that's great if my tuple only contained two longs..but what if it
contained 50
would I
It depends on how you want to manipulate the data in C. If you want
compile-time variable access to each float, yeah, 50 floats. :)
Probably what you want to do though is just keep the tuple as is and
iterate over it using the PySequence_* protocol:
http://docs.python.org/api/sequence.html
On