From: Craig W. <cra...@co...> - 2012-10-08 18:52:22
|
I have no issues with Python 3.2.2 and SWIG 2.0.8. Granted Python 3.x has significant improvements where unicode is concerned. Can you create a simpler constructor that takes just a single std::wstring to really isolate your issue? On Mon, Oct 8, 2012 at 1:40 PM, Paul Oseidon <p.o...@da...> wrote: > > Dear all, > > I have impl'ed a C++ class ParameterFloat, that has more than one ctor. > One of them is > > ParameterFloat( double value, double value_min, double value_max, > std::wstring info, std::wstring dim); > > When calling it from Python like so > > q = cpp.ParameterFloat( 0., 0., 0., u"", u"") > > I get the following error: > > > NotImplementedError: Wrong number or type of arguments for overloaded > function 'new_ParameterFloat'. > Possible C/C++ prototypes are: > ParameterFloat::ParameterFloat() > ParameterFloat::ParameterFloat(double) > ParameterFloat::ParameterFloat(double,double,double,std::wstring,std::wstring) > > > This used to work with boost, but doesn't so with SWIG. What do I have > to tell SWIG to accept the wstring-args? > > BTW, the py-code generated by SWIG is this: > > > class ParameterFloat(Parameter): > __swig_setmethods__ = {} > for _s in [Parameter]: > __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{})) > __setattr__ = lambda self, name, value: _swig_setattr(self, > ParameterFloat, name, value) > __swig_getmethods__ = {} > for _s in [Parameter]: > __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{})) > __getattr__ = lambda self, name: _swig_getattr(self, > ParameterFloat, name) > __repr__ = _swig_repr > def __init__(self, *args): > this = _core.new_ParameterFloat(*args) > try: self.this.append(this) > except: self.this = this > __swig_destroy__ = _core.delete_ParameterFloat > __del__ = lambda self : None; > def __float__(self): return _core.ParameterFloat___float__(self) > def is_in_range(self): return _core.ParameterFloat_is_in_range(self) > def range(self): return _core.ParameterFloat_range(self) > def value(self, *args): return _core.ParameterFloat_value(self, *args) > def value_min(self, *args): return > _core.ParameterFloat_value_min(self, *args) > def value_max(self, *args): return > _core.ParameterFloat_value_max(self, *args) > ParameterFloat_swigregister = _core.ParameterFloat_swigregister > ParameterFloat_swigregister(ParameterFloat) > > > The number of args matches, the first 3 args are floats/doubles, so the > wstrings must be the offending items. > > I'm on Arch Linux, Python is of version 2.7.3, SWIG is of version 2.0.8-1. > > Kind regards > Paul > > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New Relic APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > http://p.sf.net/sfu/newrelic-dev2dev > _______________________________________________ > Swig-user mailing list > Swi...@li... > https://lists.sourceforge.net/lists/listinfo/swig-user > -- /* Craig W. Wright | Chief Architect | Comet Solutions, Inc. | 505.440.7433 */ |