Managing errors generated by third party software (VTK) called via PyCall


I am trying to properly manage the exceptions created by an external software, VTK. I am calling some of its functions from PyCall as in the following example.

using PyCall
@pyimport vtk as vtk
reader = vtk.vtkXMLUnstructuredGridReader()
reader[:SetFileName]("test") #Doesn't exist

But the following window shows up instead and crashes Julia. Any idea what I am doing wrong?


This is not really a Julia issue, but a library design issue to be aware of – you would have the same issue in Python. There are many discussions about error handling on the VTK mailing lists and elsewhere, e.g.: