Embeddor Woes...

Roel Vanhout roel at riks.nl
Thu Sep 11 15:16:13 CEST 2003

Have you tried to use embedding.cpp from the boost.python examples? It 
will show if your configuration is working OK; if it is, the problem is 
obviously in your program. At first sight I'd say that your test.py 
can't be found - did you set the right working directories?



Preston H wrote:

> Hello, someone may have tackled this problem before but I have
> searched the google newsgroups up and down and I can't find anything
> on this.  I am trying to write an embedded python program in C++ that
> will go out and execute python language in a script.
> I am using Visual C++ .NET, and I do have Multithreaded DLL(/MD)
> turned on for the Runtime Library, I have the Python 2.2 installed and
> their include and libs directories are set.  Also, I have Visual C++
> .NET set to release version, mainly because I cannot find
> python22_d.dll anywhere.
> This is the error that I get when I successfully compile this program
> and try to run it at a dos prompt...
> The instruction at "0x77f85c41" referenced memory at "0x00000010". 
> The memory could not be "written".
> This is the source code that I am trying to test...
> #include "python.h"
> #include <stdio.h>
> int main(int argc, char* argv[])
> {
> 	char *filename = "test.py";
> 	FILE *OurFile = fopen(filename, "r+");
> 	Py_Initialize();
> 	PyRun_SimpleFile(OurFile, "test.py");
> 	Py_Finalize();
> 	return 0;
> }
> Like I said earlier, the program compiles without any hitches.  Any
> help on this is appreciated very much!


Roel Vanhout - Programmer/Systems Administrator
Papenstraat 8 - 6211 LG Maastricht
Tel +31 (0)43 388 3708 - Fax +31 (0)43 325 3155

More information about the Python-list mailing list