RuntimeError: unidentifiable C++ exception
Hi Everyone, I created a simple class wrapper like this BOOST_PYTHON_MODULE(PythonTest) { class_<MyClass,boost::noncopyable>("pMyClass", init<char const*>()); } When I try to initialize pMyClass in python, I got this error: Traceback (most recent call last): File "<stdin>", line 1, in ? RuntimeError: unidentifiable C++ exception MyClass is part of a third party GameEngine, I can successfully use it in C++. Can anyone suggest what might went wrong here? Thanks a lot, Qun
On 8/30/06, Qun Cao <quncao@gmail.com> wrote:
Hi Everyone,
I created a simple class wrapper like this
BOOST_PYTHON_MODULE(PythonTest) { class_<MyClass,boost::noncopyable>("pMyClass", init<char const*>()); }
When I try to initialize pMyClass in python, I got this error:
Traceback (most recent call last): File "<stdin>", line 1, in ? RuntimeError: unidentifiable C++ exception
The code generated by Py++ just works, may be you missed something? You can try to use make_consructor function: http://boost.org/libs/python/doc/v2/make_function.html#make_constructor-spec -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/
"Qun Cao" <quncao@gmail.com> writes:
Hi Everyone,
I created a simple class wrapper like this
BOOST_PYTHON_MODULE(PythonTest) { class_<MyClass,boost::noncopyable>("pMyClass", init<char const*>()); }
When I try to initialize pMyClass in python, I got this error:
Traceback (most recent call last): File "<stdin>", line 1, in ? RuntimeError: unidentifiable C++ exception
MyClass is part of a third party GameEngine, I can successfully use it in C++. Can anyone suggest what might went wrong here?
Either: a. Your C++ class threw some exception for which there's no pre-registered Boost.Python exception translator, or b. You're running on windows and your C++ code crashed. To find out if this is the case, add the following code to your module source file: # ifdef _MSC_VER # pragma warning(push) # pragma warning(disable:4297) # pragma warning(disable:4535) extern "C" void straight_to_debugger(unsigned int, EXCEPTION_POINTERS*) { throw; } extern "C" void (*old_translator)(unsigned, EXCEPTION_POINTERS*) = _set_se_translator(straight_to_debugger); # pragma warning(pop) # endif That will cause crashes to look like crashes rather than exceptions. -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (3)
-
David Abrahams -
Qun Cao -
Roman Yakovenko