Embedding Python in C

Grzegorz Dostatni grzegorz at ohaton.cs.ualberta.ca
Mon Nov 20 09:24:38 EST 2000


Hello.  
I've got a small problem.  Here's the setup:
I have a python/C program.  There is no problem with calling C functions from Python.  I'd like to do the reverse as well (callback scenario).  
I defined a function in my c-module:
PyObject * my_set_callback(dummy, args);
Just like the one in the documentation.  My only problem is that I can't call it!  If I try to pass in a function, let's say I'll do in Python:
def k():
	print "Hello World"

then try to pass k in my_set_callback
I'll get an error:
Error in argument 1 of my_set_callback.  Expected _PyObject_p.
I've tried all possible combinations.  Besides the first argument is a dummy anyways...
Any help?
By the way, I'm working on Unix, Solaris...
Grzegorz





More information about the Python-list mailing list