OK, for me this means that I will use vtk observers, since I need a portable solution that runs on a default vtk installation.<br><br>@gobbi: could you please send me a short example, of how you use these observers in python?<br>
<br>nevertheless it would be nice to see this patch in some future vtk releases. If the only problem are these unreachable code warnings in windows, why can&#39;t you simply add some helper-functions that execute this otherwise unreachable code? Since I only use Linux I will not be able to test it for myself, but I can&#39;t imagine that none of the windows programmers could find a solution for this. perhaps you should give it another try and repost the patch to the developers list?<br>
<br>thanks to all for your help<br>I wish you what<br>FloB<br><br><br><div class="gmail_quote">On Sat, May 29, 2010 at 4:36 AM, David Gobbi <span dir="ltr">&lt;<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi Charl,<br>
<br>
I&#39;ve looked over the patch and I have one question.  What happens when<br>
an python exception is thrown in a python observer callback?  I didn&#39;t<br>
see any modifications to vtkPythonCommand, so I&#39;m guessing that the<br>
error will just be printed (like it is now) and not fed back to the<br>
original caller.<br>
<font color="#888888"><br>
   David<br>
</font><div><div></div><div class="h5"><br>
<br>
On Fri, May 28, 2010 at 4:43 PM, Charl Botha &lt;<a href="mailto:c.p.botha@tudelft.nl">c.p.botha@tudelft.nl</a>&gt; wrote:<br>
&gt; Dear Florian and David,<br>
&gt;<br>
&gt; On 28 May 2010 21:07, Florian Bruckner &lt;<a href="mailto:e0425375@gmail.com">e0425375@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; is there a reason why the patch was not merged into the official vtk release?<br>
&gt;&gt;<br>
&gt;&gt; i&#39;m just wondering because that patch is fairly old and for me this seems to be a very good solution for a general problem.<br>
&gt;<br>
&gt; The patch has a permanent home here:<br>
&gt; <a href="http://code.google.com/p/devide/source/browse/trunk/johannes/patches/pyvtk_tryexcept_and_pyexceptions.diff" target="_blank">http://code.google.com/p/devide/source/browse/trunk/johannes/patches/pyvtk_tryexcept_and_pyexceptions.diff</a><br>

&gt;<br>
&gt; Of course I think it&#39;s a good patch. :) It does the following:<br>
&gt; 1. Turns all VTK errors into Python exceptions.<br>
&gt; 2. Carefully releases the GIL during all calls into VTK (grabbing it<br>
&gt; back for observers) so that you can successfully explicitly<br>
&gt; multi-thread VTK pipelines from Python.<br>
&gt; 3. Tries to trap bad_alloc.<br>
&gt;<br>
&gt; I&#39;ve been working on this for years, but due to Windows unreachable<br>
&gt; code warnings that I have not been able to solve, I&#39;ve never committed<br>
&gt; this to VTK (it works, just gives many warnings during compilation).<br>
&gt; My own binaries all have this patch integrated (DeVIDE [1] and VTK<br>
&gt; [2]).<br>
&gt;<br>
&gt; The current version is for 5.4.2, I&#39;d like to update for 5.6 as soon<br>
&gt; as I can figure out how to check out a clean 5.6 with git (until very<br>
&gt; recently there was no tag yet, I see that it&#39;s there now!<br>
&gt; <a href="http://vtk.org/gitweb?p=VTK.git;a=summary" target="_blank">http://vtk.org/gitweb?p=VTK.git;a=summary</a> )<br>
&gt;<br>
&gt; I&#39;m also considering to make a wiki page on <a href="http://devide.googlecode.com" target="_blank">devide.googlecode.com</a> that<br>
&gt; documents the patch.<br>
&gt;<br>
&gt; See you,<br>
&gt; Charl<br>
&gt;<br>
&gt; [1] <a href="http://graphics.tudelft.nl/Projects/DeVIDE" target="_blank">http://graphics.tudelft.nl/Projects/DeVIDE</a><br>
&gt; [2] <a href="http://cpbotha.net/software/latest-vtk-windows-binaries/" target="_blank">http://cpbotha.net/software/latest-vtk-windows-binaries/</a><br>
&gt;<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; On Fri, May 28, 2010 at 4:07 PM, David Gobbi &lt;<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>&gt; wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Hi Florian,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I haven&#39;t seen mention of the patch here on the list, and I know<br>
&gt;&gt;&gt; that it isn&#39;t in VTK 5.6 or in VTK devel.  For my own apps, I use<br>
&gt;&gt;&gt; VTK observers to catch reader errors.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;   David<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On Fri, May 28, 2010 at 12:52 AM, Florian Bruckner &lt;<a href="mailto:e0425375@gmail.com">e0425375@gmail.com</a>&gt; wrote:<br>
&gt;&gt;&gt; &gt; hi,<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; I just figured out the problem that no python exceptions are raised if<br>
&gt;&gt;&gt; &gt; my reader produces an error. I use vtk-5.6.<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; after searching the net and the mailing list I found that there are some<br>
&gt;&gt;&gt; &gt; patches available<br>
&gt;&gt;&gt; &gt; (turn-vtk-errors-into-python-exceptions-and-catch-bad-malloc patch)<br>
&gt;&gt;&gt; &gt; which should solve this problem. Unfortunately I could neither find such<br>
&gt;&gt;&gt; &gt; a patch for vtk-5.6 nor any actual posts about this topic.<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; So should this patch allready be included in the new vtk-5.6? or where<br>
&gt;&gt;&gt; &gt; can I get it otherwise? are there any reasons why the patch is not<br>
&gt;&gt;&gt; &gt; included in the official release? or is there another work around that<br>
&gt;&gt;&gt; &gt; is proposed for this kind of problems?<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; thanks<br>
&gt;&gt;&gt; &gt; FloB<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;&gt;<br>
&gt;&gt; Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt;<br>
&gt;&gt; Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt;&gt;<br>
&gt;&gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; dr. charl p. botha :: <a href="http://graphics.tudelft.nl/CharlBotha" target="_blank">http://graphics.tudelft.nl/CharlBotha</a><br>
&gt; work: <a href="mailto:cpbotha@medvis.org">cpbotha@medvis.org</a> personal: <a href="mailto:cpbotha@cpbotha.net">cpbotha@cpbotha.net</a><br>
&gt;<br>
&gt; See our latest papers on shape spaces, brain connectivity, shoulder<br>
&gt; segmentation, human motion analysis, voxel classification and eye fat<br>
&gt; deformation! <a href="http://graphics.tudelft.nl/Publications/2010" target="_blank">http://graphics.tudelft.nl/Publications/2010</a><br>
&gt;<br>
</div></div></blockquote></div><br>