[C++-sig] Catching C++ exceptions in Python
Niall Douglas
s_sourceforge at nedprod.com
Wed Jan 28 20:15:22 CET 2004
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 28 Jan 2004 at 15:56, James Gunn wrote:
> void Translate( FileException const& e )
> {
> PyErr_SetString( PyExc_UserWarning, e.what() );
> }
You can set any python object as the exception, not just a string.
This will achieve what you want.
(BTW you can't use BPL based objects as raisable exception types in
python because they must derive off the python class Exception).
Cheers,
Niall
-----BEGIN PGP SIGNATURE-----
Version: idw's PGP-Frontend 4.9.6.1 / 9-2003 + PGP 8.0.2
iQA/AwUBQBgKS8EcvDLFGKbPEQKyuwCbBdbtmifZCtZNQFZEUhmrYJJtue4Aniun
yT2lORvL8gNrZ5A3/Wk1yeQH
=k4TL
-----END PGP SIGNATURE-----
More information about the Cplusplus-sig
mailing list