Adding an extension class using C++

S

shlychkov

I'm building a C++ program that encapsulates Python inside and has a
few extension classes with member variables and member functions. So
far almost everything is successful, I'm able to run scripts through
the utility, I can instantiate instances of my extension classes, I can
read/write member variables of the classes through class objects, but I
just cannot make member functions work properly. When I call a
function, I get the following message:
exceptions.TypeError: 'NoneType' object is not callable
The way I extend Python is nothing (as far as I can see) different from
the documented way of doing it. This is my script:

from MyModule import *

def main():
MyInstance = MyClass()

MyInstance.memberVar1 = 1
MyInstance.memberVar2 = 20
MyInstance.memberVar3 = 300

MyInstance.print()

If I comment out the last line, I get no messages, meaning good. I also
tried printing out values after I set them and it works flawlessly.
I would really appreciate if anybody could help me, because I'm at a
loss. It probably is something really stupid, but I just fail to see it
right now.

Please help.
Thanks!
Alex.
 

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
474,276
Messages
2,571,384
Members
48,073
Latest member
ImogenePal

Latest Threads

Top