I'm trying to pass a proxy class instance (SWIG generated) of CClass,
to a python callback function from C++. The proxy class instance of
CClass is created from a pointer to the C++ class CClass.
Using the code below, I receive the error message:
"AttributeError : 'PySwigObject' object has no attribute 'GetName'"
The python callback function is being passed in through the clientdata
pointer, and the CClass *class pointer is what's being converted to an
instance of the SWIG proxy class and passed to the python callback
function as an argument.
static void PythonCallBack( CClass *class,void *clientdata)
{
PyObject *func, *arglist,*obj;
PyObject *result;
func = (PyObject *) clientdata; // Get Python function
obj = SWIG_NewPointer Obj((void*) cmd, SWIGTYPE_p_CSCS ICommand, 1);
//create instance of python proxy class from c++ pointer
arglist=Py_Buil dValue("(O)",*o bj); //convert to tuple
result = PyEval_CallObje ct(func,arglist ); // Call Python
Py_XDECREF(resu lt);
return;
}
Any input would greatly appreciated. Thanks,
Jeff 0 1729 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Andrew Collier |
last post by:
hello,
i am not sure whether this problem relates to swig, python or my c++ compiler.
+please forgive me if this is inappropriately posted but i am sure that someone
+on this list must have some good ideas. i have also sent i to the swig
users list a couple of times but have not got any response so i am casting
my net a little wider...
i have been struggling with the following problem for a couple of days now.
+specifically, i have a...
|
by: Markus von Ehr |
last post by:
Hi,
I tried to build the swig: callback example,
but when I run the runme.py file I get a message box:
abnormal program termination
The error appears in already in the first line of the python
callback generation:
# Add a Python callback (caller owns the callback, so we
|
by: Lars Moastuen |
last post by:
Im trying to extend a class written in C++ in Python and use this
extended class in a C++ call... I made an example to clarify:
-- Foo.h --
#ifndef FOO_H
#define FOO_H
#include <iostream>
using namespace std;
|
by: Bill Davy |
last post by:
I am working with MSVC6 on Windows XP.
I have created an MSVC project called SHIP
I have a file SHIP.i with "%module SHIP" as the first line (file is below).
I run SHIP.i through SWIG 1.3.24 to obtain SHIP_wrap.cpp and SHIP.py; the
latter contains the line "import _SHIP".
I compile SHIP_wrap.cpp and a bunch of files into a DLL which I have the
|
by: MSDNAndi |
last post by:
Hi,
I have a set of simple webservices calls that worked fine using .NET
Framework 1.0.
I am calling a Java/Apache based webservices, the calling side is not able
to supply a proper WSDL.
What it does is to call a webservice with two parameters, one being a
integer, the other one being a "String" which contains XML (not the best
practice, however that is the target interface and we cannot change that).
| |
by: ajikoe |
last post by:
Hi,
I tried to follow the example in swig homepage.
I found error which I don't understand.
I use bcc32, I already include directory where my python.h exist in
bcc32.cfg.
/* File : example.c */
#include <time.h>
|
by: m2i3k |
last post by:
Hi
I have C code with requires me to register a python callback. I am
able to get the callback working well using ctypes if I use global
functions without any context argument for the callback.
Now I want to register a python class member function for callback,
and give "self" as the context argument at the time of callback
registration. Then the c code can invoke the callback with self as the
context argument
|
by: Keith Sabine |
last post by:
Hi
Did you ever find a solution to this? I am having the exact same problem...
- Keith
I'm trying to pass a proxy class instance (SWIG generated) of CClass,
to a python callback function from C++. The proxy class instance of
CClass is created from a pointer to the C++ class CClass.
|
by: Uberman |
last post by:
I have a bit of a odd arrangement here with SWIG, Python, Embedded Python and
C++ classes exported into Python. Here's the plot:
I have a class defined in a C++ DLL library. I am wrapping this class (we'll
call it "Peter") with SWIG so some of its base functionality is available in
Python. For the sake of this example, Peter has a method called get_type(),
that takes no arguments and returns an integer. This all works, and within my...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |