# implementing CanReadFile in a VTKPythonAlgorithmBase

**URL:** https://discourse.paraview.org/t/implementing-canreadfile-in-a-vtkpythonalgorithmbase/6933
**Category:** Development
**Created:** [April 12, 2021, 1:18pm UTC](https://discourse.paraview.org/t/implementing-canreadfile-in-a-vtkpythonalgorithmbase/6933 "2021-04-12T13:18:39Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Felipe\_Bordeu](https://discourse.paraview.org/user_avatar/discourse.paraview.org/felipe_bordeu/32/6143_2.png) [@Felipe\_Bordeu](https://discourse.paraview.org/u/Felipe_Bordeu)
#### Post date: [April 12, 2021, 1:18pm UTC](https://discourse.paraview.org/t/implementing-canreadfile-in-a-vtkpythonalgorithmbase/6933/1 "2021-04-12T13:18:39Z")

</div>

Hello,

I using VTKPythonAlgorithmBase to prototype a reader. I implemented the CanReadFile function in python but I’m unable make ParaView use it. I have 2 reader using the same extension, but only one return 1 in the function CanReadFile. But paraview keep showing me the dialogbox “Open Data With…” choose a reader. (the function are not called, I put prints statements to track the functions calls)

It is possible to implement the CanReadFile in python?

More info about this function in : [https://www.paraview.org/Wiki/Writing\_ParaView\_Readers](https://www.paraview.org/Wiki/Writing_ParaView_Readers)

Thanks Felipe,

ps: using Paraview 5.8.1 on linux

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [April 12, 2021, 1:51pm UTC](https://discourse.paraview.org/t/implementing-canreadfile-in-a-vtkpythonalgorithmbase/6933/2 "2021-04-12T13:51:49Z")

</div>

That is indeed correct. Mind reporting a bug please? I think this patch address the issue (at least with `master`). I suspect it should work for 5.8.1. too.

[fix.patch](https://discourse.paraview.org/uploads/short-url/zC2HVdJhPv4onGwDxUJJOnZjFN.patch) (1.1 KB)

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [April 12, 2021, 1:57pm UTC](https://discourse.paraview.org/t/implementing-canreadfile-in-a-vtkpythonalgorithmbase/6933/3 "2021-04-12T13:57:49Z")

</div>

Here’s an MR for the same: [https://gitlab.kitware.com/paraview/paraview/-/merge\_requests/4881](https://gitlab.kitware.com/paraview/paraview/-/merge_requests/4881)

---

<div class="post-metadata">

### Author: ![Felipe\_Bordeu](https://discourse.paraview.org/user_avatar/discourse.paraview.org/felipe_bordeu/32/6143_2.png) [@Felipe\_Bordeu](https://discourse.paraview.org/u/Felipe_Bordeu)
#### Post date: [April 12, 2021, 2:24pm UTC](https://discourse.paraview.org/t/implementing-canreadfile-in-a-vtkpythonalgorithmbase/6933/4 "2021-04-12T14:24:43Z")

</div>

Thanks,

I’m going to try to use this patch with my current paraview install.

Thanks again,  
Felipe

---

<div class="post-metadata">

### Author: ![Felipe\_Bordeu](https://discourse.paraview.org/user_avatar/discourse.paraview.org/felipe_bordeu/32/6143_2.png) [@Felipe\_Bordeu](https://discourse.paraview.org/u/Felipe_Bordeu)
#### Post date: [April 12, 2021, 2:28pm UTC](https://discourse.paraview.org/t/implementing-canreadfile-in-a-vtkpythonalgorithmbase/6933/5 "2021-04-12T14:28:32Z")

</div>

I see the MR, do I still need to report an issue ??

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [April 12, 2021, 2:29pm UTC](https://discourse.paraview.org/t/implementing-canreadfile-in-a-vtkpythonalgorithmbase/6933/6 "2021-04-12T14:29:21Z")

</div>

not necessary. I’ll just add a reference to this post in the MR so we can track the change.
