What's wrong?
Hello everyone! I wanted to write python script with defined function. From that script I wanted to call C module, which in it's turn call defined python function. Sounds simple. But I've got some troubles in realization. I'm beginner at python so it's normal, I think. :) Here's the code. I'll apreciate if anyone can answer me what's wrong here. --- power.c: #include "Python.h" static PyObject * power(PyObject *self, PyObject *args) { PyObject *result, *temp; int num; if (PyArg_ParseTuple(args, "iO", &num, &temp)) { if (!PyCallable_Chack(temp)) //here's error, but I don't know why... { return NULL; } } result = Py_BuildValue("i", num*num); PyEval_CallObject(temp, result); Py_DECREF(result); Py_INCREF(Py_None); retrun Py_None; } static struct PyMethodDef power_methods[] = { {"power", power, METH_VARARGS, "powering number"}, {NULL, NULL, 0, NULL} }; void initpower() { (void) Py_InitModule("power", power_methods); } --- --- power.py: import power def sst(some): print some power.power(9, sst) --- -- http://mail.python.org/mailman/listinfo/python-list
Re: What's wrong?
:)) Oа course it PyCallable_Check there!!! :)) And error is that PyCallable_Check returned 0. power.c compiles without errors. error is here: --- [EMAIL PROTECTED] 1]$ make -f makefile.power gcc power.c -g -I/usr/local/include/python2.4 -fpic -shared -o power.so [EMAIL PROTECTED] 1]$ python power.py Exception exceptions.TypeError: 'argument list must be a tuple' in 'garbage collection' ignored Fatal Python error: enexpected exception during garbage collection Aborted --- -- http://mail.python.org/mailman/listinfo/python-list
Re: What's wrong?
Thank you for fast response! And I'm sorry for bad style of asking questions! -- http://mail.python.org/mailman/listinfo/python-list
Re: What's wrong?
Man! It's alive! :) Now next question: where are you living? I must know that for buy you some beer!! Thanks a lot!!! -- http://mail.python.org/mailman/listinfo/python-list
Have you any idea how to make window transparent using pygame?
Hello everybody! I just want to make window transparent. ;) At this moment I've found only ideas of taking screenshots to make background... Anything else? Thanks for help! -- http://mail.python.org/mailman/listinfo/python-list
Re: simple perl program in python gives errors
Maybe you should initialize a before using it? :) -- http://mail.python.org/mailman/listinfo/python-list
Re: simple perl program in python gives errors
Of course Grant Edwards is right, but I thought that your programm is something like this: a += 20 * 14 print a and I thought that this is your perl program: $a += 20 * 14 print $a Funny if Grant Edwards is right... :) -- http://mail.python.org/mailman/listinfo/python-list