[Python-de] Access violation Fehler beim Debuggen
Georg Mischler
schorsch at schorsch.com
Mon May 13 13:35:16 EDT 2002
Marcus K. wrote:
> Hallo !
>
> Ich wollte ein C Programm mit einem Python Skript erweitern und habe
> mittlerweile auch die Beispiele unter ..\Python-2.2.1\Demo\embed
> ans laufen bekommen. Das mit dem pcbuild.dsw hat dann doch mal geklappt
> :-) , vielen Dank an all die Leute, die mir diesbezüglich geholfen haben !
> Beim Einbinden des Python Skriptes bekomme ich allerdings in der Zeile
> res = PyRun_SimpleFile(fp,"modulefile.py");
> einen access violation error im kernel32.dll. Der C Code sieht in
> Auszügen folgendermaßen aus:
>
> 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");
>
> }
Hast du schon mal daran gedacht, vor PyRun_SimpleFile() zu
ueberpruefen, ob fp eventuell NULL ist? Das wird immer dann
der Fall sein, wenn dein Script nicht im aktuellen Verzeichnis
des Prozesses liegt, und fuehrt mit Garantie zu Problemen.
-schorsch
--
Georg Mischler -- simulations developer -- schorsch at schorsch.com
+schorsch.com+ -- lighting design tools -- http://www.schorsch.com/
More information about the Python-de
mailing list