Re: How to call TPyException in Python?

From: OKUMURA, Akira <oxon_at_astro.isas.jaxa.jp>
Date: Tue, 3 May 2011 19:58:58 -0700


Hello Wim,

Thanks a lot.

What I want to do is to throw C++ exceptions from my C++ ROOT code, and catch them in PyROOT. I thought that it could be done by using PyROOT::TPyException. Because the explanation in its header says as follow.



http://root.cern.ch/root/html/PyROOT__TPyException.html Purpose: A C++ exception class for throwing python exceptions

         through C++ code.


But according to your comment, my understanding seems to be wrong. Is there any tutorial of TPyException?

Regards,

--
OKUMURA, Akira oxon@{astro.isas.jaxa.jp,stanford.edu}
Institute of Space and Astronautical Science (ISAS/JAXA)
Now at KIPAC/SLAC/Stanford
Varian Physics #306, 382 Via Pueblo Mall, MC 4060
Stanford, CA 94305-4060
TEL 650-736-0971/FAX 650-724-5065
Skype : okumura.akira

On 2011/05/03, at 19:43, wlavrijsen_at_lbl.gov wrote:


> Akira,
>
>> TypeError: type 'instance' is not an acceptable base type
>
> a quick look seems to indicate that ROOT.py is mistakenly creating class
> std.exception as a template instance, rather than a class. Will fix tomorrow.
>
> I'm not sure why there's a complaint about not having a dictionary for
> exception, when the same does not happen with root.exe.
>
> All that said, why care about TPyException from python? Its purpose is to
> be thrown from and caught by C++.
>
> Best regards,
> Wim
> --
> WLavrijsen_at_lbl.gov -- +1 (510) 486 6411 -- www.lavrijsen.net
Received on Wed May 04 2011 - 04:59:14 CEST

This archive was generated by hypermail 2.2.0 : Wed May 04 2011 - 11:50:02 CEST