Re: embedding python in C, working but with exception at the end

2005-09-03 Thread jepler
I see a couple of problems. First, because I'm using Unix, where filenames are case-sensitive, I had to '#include "Python.h"' instead of '#include "python.h"'. Next, it looks like the behavior that '.' is placed on sys.path isn't done automatically when embedding. So I had to set the environment

Re: embedding python in C, working but with exception at the end

2005-09-03 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Program crashes at line Py_Finalize(). Program tries to read some >memory location and suffer run time exception. PyTuple_SetItem "steals" a reference, so changing Py_XDECREF(stringarg); Py_XDECREF(args); to just Py_XDECREF(args); might fix the problem.

embedding python in C, working but with exception at the end

2005-09-03 Thread brobigi
well I manage to figure it out myself. I'm using Bloodshed Dev-cpp Here's the code: #include "python.h" #include int main(int argc, char* argv[]) { double answer = 0; PyObject *modname, *mod, *mdict, *func, *stringarg, *args, *rslt; Py_Initialize(); modname = PyStri