473,385 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Embeddor Woes...

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!
Jul 18 '05 #1
4 1943
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?

cheers,

roel
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
RIKS BV
Papenstraat 8 - 6211 LG Maastricht
Tel +31 (0)43 388 3708 - Fax +31 (0)43 325 3155
Jul 18 '05 #2
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?

cheers,

roel
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
RIKS BV
Papenstraat 8 - 6211 LG Maastricht
Tel +31 (0)43 388 3708 - Fax +31 (0)43 325 3155

Jul 18 '05 #3
PyRun_SimpleFile doesn't work for me too.

As a workaround I suggest to replace it with:
PyRun_SimpleString("execfile('test.py')");

Kerim

"Roel Vanhout" <ro**@riks.nl> wrote in message
news:ma**********************************@python.o rg...
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?

cheers,

roel
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
RIKS BV
Papenstraat 8 - 6211 LG Maastricht
Tel +31 (0)43 388 3708 - Fax +31 (0)43 325 3155

Jul 18 '05 #4
That did it... I wonder why PyRun_SimpleFile or PyRun_File won't
work? Do I have to recompile the python source under MSVC++.NET?

"Kerim" <my@mail.ru> wrote in message news:<3f618ea9$1@shknews01>...
PyRun_SimpleFile doesn't work for me too.

As a workaround I suggest to replace it with:
PyRun_SimpleString("execfile('test.py')");

Kerim

"Roel Vanhout" <ro**@riks.nl> wrote in message
news:ma**********************************@python.o rg...
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?

cheers,

roel
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
RIKS BV
Papenstraat 8 - 6211 LG Maastricht
Tel +31 (0)43 388 3708 - Fax +31 (0)43 325 3155

Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Mark | last post by:
O, woe is me, to have seen what I have seen, see what I see! (That's Shakespeare for those who were wondering what I'm on about) I am "having fun" with cookies. And I wonder if I have...
0
by: Cedric | last post by:
This is a 3 weeks old problem, but having found a solution (and having looked for one here, finding only this message), I'm replying now. From: Jive (someone@microsoft.com) Subject: Upgrade...
3
by: Angel Cat | last post by:
Trying to get my jobs to send mail when job fails. Should be easy but it's giving me headache Had a whole slew of issues. Outlook is installed with a n outlook mail profile set up that can...
2
by: Andrew Thompson | last post by:
- NN 4.78 rendering woes, links at far left - I am trying to rework an old site, make it valid html and css, improving the x-browser and 'older browser' compatibility. My efforts so far, have...
0
by: Arun Bhalla | last post by:
I'm having some inconsistency problems with my deployment project ("Setup") and its custom actions ("Installer"). I'm using Visual Studio .NET 2003 (.NET 1.1, no service pack) on Windows XPSP1. ...
9
by: Mark Rae | last post by:
Hi, This time, I'm looking for a regular expression which says "the string must contain exactly seven or exactly eight digits" e.g. 123456 fails 1234567 passes 12345678 passes 123456789...
1
by: hdogg | last post by:
Scope Woes - IF statement nested in WHILE statement -PHP I have an array $actuals_sum. <?php while(conditions) { if($i == '24) {
4
by: =?Utf-8?B?VkIgSm9ubmll?= | last post by:
I am at my witless end here, please help! I have an ASP.Net aspx web page, hosted on Windows Server 2003, that receives a query string with the path to an autocad drawing file selected from a...
1
by: Mike Howarth | last post by:
I've been having a few problems with connecting to SQL Server, initially I was using dblib however found some problems with returning text fields whereby all text fields were ignored and it bawked...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.