Embedding Python in C++ Problem

G

gavinpaterson

Dear Pythoners,

I am trying to embed a Python script into a C++ application for the
first time.

Although I have used the example 5.3 Pure Embedding I am having
problems with calling the function defined in my program.

If I define function multiply in module "multiply.py"

def multiply(a,b):
print "Will compute", a, "times", b
c = 0
for i in range(0, a):
c = c + b
return c

Then call the program with the following arguments:

multiply multiply 2 3

Then I'd expect to see the result appear in stdout. The compiled
module is found but the program fails to get past:

if (pFunc && PyCallable_Check(pFunc))

I am using VC7.1 on windows XP. Where am I going wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top