Problems embedding Python
Joe Francia
usenet at -OBFUSCATED-joefrancia.com
Sat Jan 31 19:10:44 EST 2004
Psymaster wrote:
> I've tried running scripts from the embedded interpreter but it doesn't
> work. If I try the same scripts as strings to interpret it works. Here
> is my program:
>
> #include <stdio.h>
> #include "Python.h"
>
> int main(int argc, char *argv[])
> {
> FILE *script = fopen("c:/c.py", "r");
>
> Py_Initialize();
> PyRun_SimpleFile(script, "c.py");
> Py_Finalize();
>
> return 0;
> }
>
>
> c.py contains just a simple print statement.
>
> This compiles and links under MSVC 6 but when run crashes. Any help?
Maybe escape your backslash? :
FILE *script = fopen("c:/c.py", "r");
------------------------^
More information about the Python-list
mailing list