M
Mr.M
Hi,
i can't understand what i'm doing wrong. I have a c/api that implements
a new class.
In (initproc) function i have somethink like this:
Ok, what i want is something like this:
I found that if i write this everything works fine:
in other words, the code only works if *EVERY* argument is specified in
exactly the same position it appears in keyword-null-terminated array.
Could you please help me?
Thank you,
Luca.
i can't understand what i'm doing wrong. I have a c/api that implements
a new class.
In (initproc) function i have somethink like this:
Code:
(some declarations omitted here)
static char* keywordlist[] = {"service",
"event_type",
"free_text",
"group_uid",
"remote_name",
"remote_abook_uid",
"start_time",
"end_time",
"storage_time",
"flags",
"bytes_sent",
"bytes_received",
NULL};
if (!PyArg_ParseTupleAndKeywords(args, keywords, "|ssssssiiiiii",
keywordlist,
&service,
&event_type,
&free_text,
&group_uid,
&remote_name,
&remote_abook_uid,
&start_time,
&end_time,
&storage_time,
&flags,
&bytes_sent,
&bytes_received)) return -1;
Ok, what i want is something like this:
Code:
import mymodule
a = mymodule.myclass() # ok, this works
a = mymodule.myclass(flags = 1) # bad, this won't work[QUOTE]
> TypeError: expected string or Unicode object, tuple found[/QUOTE]
I found that if i write this everything works fine:
Code:
import mymodule
a = mymodule.myclass(service = "blabla", event_type = "event", free_text
= "free", group_uid = "group", remote_name = "remote name",
remote_abook_uid = "abook", start_time = 1, end_time = 61, storage_time
= 61, flags = 2)
in other words, the code only works if *EVERY* argument is specified in
exactly the same position it appears in keyword-null-terminated array.
Could you please help me?
Thank you,
Luca.