id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 6203,boost::python::api::object constructor failure,Johan Råde ,Ralf W. Grosse-Kunstleve,"Here is the C++ code for a Python extension module and a Python script that calls the module. Expected behavior when you run the script: {{{ The script runs and produces the output ""Hello, I'm Y!"" }}} Observed behavior (with Boost 1.48.0, Python 2.7.2, MSVS 2010): {{{ The script fails with the error message: Traceback (most recent call last): File ""../TestHello/TestHello.py"", line 12, in y = Hello.create('Y') TypeError: No to_python (by-value) converter found for C++ type: class Y Press any key to continue . . . }}} I have also attached a zip file with the code as a solution for MSVS 2010 and Python Tools for Visual Studio. Hello.cpp: {{{ #include #include #include #include using std::string; using boost::noncopyable; using boost::python::class_; using boost::python::def; class X : noncopyable { public: string hello() const { return ""Hello, I'm X!""; } }; class Y : noncopyable { public: string hello() const { return ""Hello, I'm Y!""; } }; class Z : noncopyable { public: string hello() const { return ""Hello, I'm Z!""; } }; PyObject* create(char c) { if(c == 'X') return boost::python::api::object(new X).ptr(); else if(c == 'Y') return boost::python::api::object(new Y).ptr(); else if(c == 'Z') return boost::python::api::object(new Z).ptr(); else throw std::exception(""The function argument must be 'X', 'Y' or 'Z'.""); } BOOST_PYTHON_MODULE(Hello) { class_(""X"").def(""hello"", &X::hello); class_(""Y"").def(""hello"", &Y::hello); class_(""Z"").def(""hello"", &Z::hello); def(""create"", &create); } }}} Test.py: {{{ import Hello y = Hello.create('Y') print(y.hello()) }}} ",Bugs,closed,To Be Determined,python USE GITHUB,Boost 1.48.0,Problem,invalid,,