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

**URL:** <https://discourse.julialang.org/t/managing-errors-generated-by-third-party-software-vtk-called-via-pycall/4358>\
**Category:** General Usage\
**Created:** [June 20, 2017, 3:11am UTC](https://discourse.julialang.org/t/managing-errors-generated-by-third-party-software-vtk-called-via-pycall/4358 "2017-06-20T03:11:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohamed82008](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mohamed82008/32/18171_2.png) [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Post date:** [June 20, 2017, 3:11am UTC](https://discourse.julialang.org/t/managing-errors-generated-by-third-party-software-vtk-called-via-pycall/4358/1 "2017-06-20T03:11:20Z")

</div>

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.

```julia
using PyCall
@pyimport vtk as vtk
reader = vtk.vtkXMLUnstructuredGridReader()
reader[:SetFileName]("test") #Doesn't exist
try
     reader[:Update]()
catch
     println("Error")
end

```

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

 ![](https://global.discourse-cdn.com/julialang/original/3X/1/5/1538caf4c1d2142d30f38d08f4f546b1240929b2.png)

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihnorton/32/26_2.png) [@ihnorton](https://discourse.julialang.org/u/ihnorton)\
**Post date:** [June 20, 2017, 4:15am UTC](https://discourse.julialang.org/t/managing-errors-generated-by-third-party-software-vtk-called-via-pycall/4358/2 "2017-06-20T04:15:17Z")

</div>

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.:

> <https://stackoverflow.com/questions/23573707/disable-or-catch-vtk-warnings-in-vtkoutputwindow-when-embedding-mayavi>
