Differences between revisions 1 and 4 (spanning 3 versions)
Revision 1 as of 2003-01-09 21:36:44
Size: 380
Editor: MikeRovner
Comment:
Revision 4 as of 2003-01-17 18:04:41
Size: 1212
Editor: MikeRovner
Comment: unidentifiable C++ Exception
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
==== TypeError: bad argument type for built-in operation ==== === TypeError: bad argument type for built-in operation ===
Line 8: Line 8:

=== TypeError: No to_python converter found for C++ type: <type> ===
=== TypeError: No to_python (by-value) converter found for C++ type: <type> ===
BPL was unable to get C++ value from Python object.

For example, when calling {{{ extract<int>(<object>.attr("__len__")()) }}} to get object length
you omitted "'''()'''".

=== RuntimeError: This class cannot be instantiated from Python ===
Attempt to instantiate a class with ''no_init'' descriptor.
It may be private constructor or abstract class.

=== RuntimeError: unidentifiable C++ Exception ===
Boost.Python provides a default exception handler that translates selected standard exceptions, then gives up
with that message.

To install your own exception translator see [http://www.boost.org/libs/python/doc/tutorial/doc/exception_translation.html tutorial].

["boost.python"] tries hard to provide best possible run-time errors. But often enough they need futher explanation. Some of them are mentioned below:

TypeError: bad argument type for built-in operation

Usualy means BPL couldn't find c++ method/function with appropriate signature. Very often that is wrong number of arguments, wrong argument(s) type and so on.

TypeError: No to_python converter found for C++ type: <type>

TypeError: No to_python (by-value) converter found for C++ type: <type>

BPL was unable to get C++ value from Python object.

For example, when calling  extract<int>(<object>.attr("__len__")())  to get object length you omitted "()".

RuntimeError: This class cannot be instantiated from Python

Attempt to instantiate a class with no_init descriptor. It may be private constructor or abstract class.

RuntimeError: unidentifiable C++ Exception

Boost.Python provides a default exception handler that translates selected standard exceptions, then gives up with that message.

To install your own exception translator see [http://www.boost.org/libs/python/doc/tutorial/doc/exception_translation.html tutorial].

boost.python/RuntimeErrors (last edited 2008-11-15 13:59:38 by localhost)

Unable to edit the page? See the FrontPage for instructions.