[Tutor] getting access violation error in kernel32.dll while debugging

Marcus K. m_konermann@gmx.de
Mon, 13 May 2002 17:58:28 +0200


Hi !

I want to embbed C source code with a python script, named 
modulefile.py. Here´s the intresting part of my c code:

void getValues(char **firstName, char **lastName, char **profession) {

    FILE *fp = NULL;
    PyObject *module, *fn, *ln, *prof;
    int res;

    module = PyImport_AddModule("__main__");

     fp = fopen("modulefile.py","r");
    res = PyRun_SimpleFile(fp,"modulefile.py");
  
}
void main(int argc, char *argv[]) {

    char *firstName, *lastName, *profession;
    Py_Initialize();
    PySys_SetArgv(argc, argv);
    getValues(&firstName, &lastName, &profession);

After the debugger reaches the statemant:

res = PyRun_SimpleFile(fp,"modulefile.py");

I get a acess violation error in kernel32.dll. Have anyone got an idea 
what happend ?
All the examples in the source code 
(D:\home\...\Python-2.2.1\Demo\embed) are working, so it does´nt seem to 
be a compiler configuration error.

Thanks a lot, greetings
Marcus