[vtkusers] Python Threads and vtk render loop?

Charl Botha c.p.botha at tudelft.nl
Fri Jul 17 10:38:57 EDT 2009


2009/7/17 guillaume ranquet <granquet at wyplay.com>:
> well, from my various attempts, It seems that vtk doesn't return to
> python when the render loop starts and thus holding the GIL, which
> prevents pythons' Threads to run in //.
>
> can someone confirm this?
> is there a way to make use of threads with the Python binding?

Only with my patch:
http://code.google.com/p/devide/source/browse/trunk/johannes/patches/pyvtk_tryexcept_and_pyexceptions.diff

This has been integrated in the VTK / Python binaries I distribute:
http://cpbotha.net/software/latest-vtk-windows-binaries/

... and will soon be integrated in the yet-to-be-released DeVIDE
Runtime Environment (DRE).

Besides enabling multi-threaded VTK from Python, as it correctly
releases and gets back the GIL around VTK calls, even around
exceptions, it also turns VTK errors into Python exceptions (this was
the primary purpose, the thread-thing is a side-effect :)

I hope to commit this full patch to VTK as soon as somebody helps me
solving the unreachable code problem on Windows.  Visual Studio
doesn't like me putting a try...catch around VTK calls of which it
thinks that they won't raise exceptions.  This has to do with the C++
method signature.

See you,
Charl



More information about the vtkusers mailing list