# Try and except problem when LegacyVTKReader is run

**URL:** https://discourse.paraview.org/t/try-and-except-problem-when-legacyvtkreader-is-run/9032
**Category:** ParaView Support
**Created:** [February 22, 2022, 3:30am UTC](https://discourse.paraview.org/t/try-and-except-problem-when-legacyvtkreader-is-run/9032 "2022-02-22T03:30:42Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![rasunag27](https://discourse.paraview.org/user_avatar/discourse.paraview.org/rasunag27/32/4636_2.png) [@rasunag27](https://discourse.paraview.org/u/rasunag27)
#### Post date: [February 22, 2022, 3:30am UTC](https://discourse.paraview.org/t/try-and-except-problem-when-legacyvtkreader-is-run/9032/1 "2022-02-22T03:30:42Z")

</div>

Hi,

This is a simple question which I am unable to resolve it. So, here is the thing.

I have a vtk file which is read through LegacyVTKReader. I am using python exception handling to print an exception error if file is not present. But, I am unable to print the exception error and instead it prints as `'NoneType' object has no attribute 'NewInstance'`.

How to change to proper exception handling such that if file is not present, it shows exception error?

My code of exception handling is below.

```auto
try:
 pv_reader = LegacyVTKReader(FileNames=[vtk_file_path])
except FileNotFoundError:
 print('vtk file is not present')

```

Any leads will be appreciated.

Regards,  
Sunag R A.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 23, 2022, 10:12am UTC](https://discourse.paraview.org/t/try-and-except-problem-when-legacyvtkreader-is-run/9032/2 "2022-02-23T10:12:31Z")

</div>

I’m no python expert, but I think the `FileNotFoundError` is never sent. Why do you expect it ? ParaView do not use exception at all.
