[vtkusers] Re: [vtk-developers] RFC: patch for VTK errors as python exceptions and trapping of bad_alloc
Prabhu Ramachandran
prabhu at aero.iitb.ac.in
Sun Nov 18 02:00:46 EST 2007
Charl Botha wrote:
> I have just updated the Python VTK errors as exception + bad_alloc
> trapping patch to the latest ParaView-3-2 branch checkout of VTK (it
> should be applicable to head) and made it available at [1]. This
> patch:
> 1. turns all VTK errors into Python exceptions. It even maintains
> exception information if a user observer is invoked before the end of
> the VTK method that triggered the error.
> 2. surrounds all VTK method calls in the Python wrappers with
> try...catch, so that we can catch things like bad_alloc as well.
Very cool! I haven't tried it yet but have a few comments:
1. You should really do: "import os.path; os.path.normpath...".
2. Normpath will also convert "http://foo" to "http:/foo", do you
really want that?
3. Would it be possible to separate out the two new features into two
separate checkins just in case?
4. I think it would be better to use the warnings module to indicate
warnings rather than raise exceptions. That way a user could filter
out warnings if they wanted to.
> I've been running with this for quite a while, it seems quite solid
> and I would like to commit it. However, I would appreciate some
> general comments, and especially on the try...catch, as it's causing
> my VS 2005 to generate hundreds of "unreachable code" warnings in the
> wrapper code. Does anyone know how to get around these? I assume
Not sure.
> it's because the surrounded VTK method doesn't have a throws
> classifier. Any other thoughts?
Thanks for all the effort on this!
cheers,
prabhu
More information about the vtkusers
mailing list