473,387 Members | 1,542 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,387 software developers and data experts.

Adding an extension class using C++

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.

Jan 12 '06 #1
0 804

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

Similar topics

4
by: jsWalter | last post by:
I have an extension Class to Auth and I'm looking for some folks to hammer on it a bit and give feed back. Class: AuthUser - add user (well, Auth does that now, so its gone) - remove user...
0
by: vincent wehren | last post by:
Hi folks, How can I add an attribute to a C-coded class (..using PyClass_New()...) in the __init__ method of that class, making it show up in "self.__dict__" on the Python side? IOW,...
1
by: Geoff Biggs | last post by:
Evening all, I'm trying to add a new built-in number data type to Python with its own syntax, so I'm working directly with the interpreter rather than creating my own extension module (side...
3
by: Deckarep | last post by:
I recently got into somewhat of a debate with a fellow co-worker. First I asked him if he new of a way to add a method to an existing class like enhancing a class but without using Inheritance. He...
5
by: pythoncurious | last post by:
Hi, I'm having a bit of trouble when writing a python extension. I can't seem to figure out what I did wrong. I tried to make a minimal example, but it's still quite a bit of code. It would be...
0
by: =?Utf-8?B?QW5keSBZdQ==?= | last post by:
Hi, I'm trying to return exceptions from a WCF Service using FaultExceptions. I got the service compiled and running. But I get an error while adding a service reference to it. The error reads: "...
0
by: paulquinlan100 | last post by:
Hi Could someone point me in the right direction. Im trying to update an Access DB using the code below, it seems to all run correctly and I dont get any error messages, however it doesnt...
1
by: Mike Hofer | last post by:
We have an extension method defined that is causing all sorts of compiler grumpiness in one of our projects, and we don't know why. The method in question isn't rocket science, so here it is, in...
3
by: raylopez99 | last post by:
The headline says it all. Great minds think alike: read the blog below from three years ago, as endorsed by Ritchie, who coinvented C. BTW the below lambda expression code will not work (.Where...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.