Swig/Python: data type problem
Carole Valentin
carole at autosim.no
Tue Apr 2 06:14:46 EST 2002
Hello,
I have 2 modules: Module 1 written in C++ (Visual C++ 5.0) and Module
2 in Python (Python 2.1).
I use Swig to make accessible the data from the Module 1 to the Module
2.
In the Module 1, I have a function which read a file:
void read(String* namefile);
In the Module 2, I build a window (with wxPython) with a popup list
which contains the names of the different files. When I choose a file
name:
# import the Module 1 project:
from Module1 import *
# create a new object:
object = MyObject()
# read the database file with the
# parameter "namefile" = the name choosen just before:
object.read(namefile)
In Python, we don't declare the data so "namefile" doesn't have any
data type.
But in C++, we expect a data type:
void MyObject::read(String* namefile)
I tryed with 3 data types: char / string / string*
Each time, I have the same error:
File "c:\python21\Module1.py", line 172, in read
val = apply(Interfc.RoadNetwork_lecture,args)
TypeError: Type error. Expected _p_String
Do you have any suggestion?
Thanks a lot,
Carole.
More information about the Python-list
mailing list