[C++-sig] Exception 'No to_python (by-value) converter found - 'garbage collection'

Eduardo Picado eduardo.picado at gmail.com
Wed Sep 13 18:56:26 CEST 2006


Hi,

Im writing the following kind of python code using a C++ wrapped library:



system = TASRSystem.getASRSystem()
system.setParameter(TASRSystem.Option.asrServersListenPort, 32000)

try:
	system.initialize(1, 3000)
except Exception, e:
	sys.stderr.write("[E] : " +  e.__class__.__name__ + str(e) )
print "ok"



Running it I get:



ok
Exception exceptions.TypeError: 'No to_python (by-value) converter
found for C++ type:
class TASRSystem' in 'garbage collection' ignored
Fatal Python error: unexpected exception during garbage collection



The declaration of TASRSystem is like:



BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(TASRSystem_initialize_overloads_0_2,
initialize, 0, 2)

class_< TASRSystem, boost::noncopyable >("TASRSystem", no_init)
	.def("getASRSystem", &TASRSystem::getASRSystem,
return_value_policy<reference_existing_object>())
	.def("initialize", &TASRSystem::initialize,
TASRSystem_initialize_overloads_0_2())
	.staticmethod("getASRSystem")


- TASRSystem.getASRSystem() is an static method, that creates and
returns an instance of an ASRSystem. Seems ok.
I've tried to use with_custodian_and_ward_postcall <1, 0>, to ensure
that the lifetime of the created instance is as long
as that of the Python object, but it didn't worked - gives "argument
index out of range".


- setParameter() seems good, as I can check with a .getParameter() call.

- system.initialize() It doesn't return anything, I think it just
tries to find/connect to remote ressources based on the parameters. It
seems to work, the "ok" is printed but after it gives the "No
to_python (by-value) converter found"... associated with the Python
garbage collection...


Some ideas?


Thanks very much,


Eduardo

-- 
Eduardo PICADO
MSN eduardo.picado at gmail.com
portable +33 6 32 47 10 10 (NEW)
fix +33 1 45 03 52 54
|̲̅<̲̅Θ̲̅>̲̅|


More information about the Cplusplus-sig mailing list