# Suggestion for Python SaveData() method

**URL:** https://discourse.paraview.org/t/suggestion-for-python-savedata-method/9500
**Category:** ParaView Support
**Created:** [April 22, 2022, 8:27pm UTC](https://discourse.paraview.org/t/suggestion-for-python-savedata-method/9500 "2022-04-22T20:27:54Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [April 22, 2022, 8:27pm UTC](https://discourse.paraview.org/t/suggestion-for-python-savedata-method/9500/1 "2022-04-22T20:27:54Z")

</div>

I was thinking of how often I’m generating Python scripts through the Trace capability and something that often comes up is that the serial VTK XML writers are used in the GUI when generating the trace but when I’m running the trace I really want to use the parallel VTK XML writers. That is, I get the following in the Trace:

```auto
SaveData('/home/acbauer/aaaa.vti', proxy=wavelet1, PointDataArrays=['RTData'])

```

but would have preferred to have:

```auto
SaveData('/home/acbauer/aaaa.pvti', proxy=wavelet1, PointDataArrays=['RTData'])

```

Note the `.vti` extension instead of the `.pvti` extension. So if I would run the script in parallel with `pvbatch` in PV 5.10 I’d get the following error:

```auto
( 2.889s) [pvbatch.0] vtkSMWriterFactory.cxx:344 ERR| vtkSMWriterFactory (0x18f59c0): No matching writer found for extension: vti
Traceback (most recent call last):
  File "/home/acbauer/testserial.py", line 17, in <module>
    SaveData('/home/acbauer/abc.vti', proxy=wavelet1, PointDataArrays=['RTData'])
  File "/home/acbauer/Code/ParaView/ParaView-5.10.0-MPI-Linux-Python3.9-x86_64/lib/python3.9/site-packages/paraview/simple.py", line 1266, in SaveData
    writer = CreateWriter(filename, proxy, **extraArgs)
  File "/home/acbauer/Code/ParaView/ParaView-5.10.0-MPI-Linux-Python3.9-x86_64/lib/python3.9/site-packages/paraview/simple.py", line 1252, in CreateWriter
    writer_proxy.UnRegister(None)
AttributeError: 'NoneType' object has no attribute 'UnRegister'

```

So what I’m proposing for the VTK XML writers for `SaveData()` in parallel is to automatically replace the serial version with the parallel version. A warning could be added in if that seems appropriate but this seems like a convenience thing to do for users for both ease of use as well as for users that haven’t quite picked up on the subtle difference between the serial and parallel versions of the VTK XML writers.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.paraview.org/u/ben.boeckel)
#### Post date: [May 16, 2022, 12:37am UTC](https://discourse.paraview.org/t/suggestion-for-python-savedata-method/9500/2 "2022-05-16T00:37:13Z")

</div>

Sounds like a VTK feature request to me. Might require some work on the writer class hierarchy.

---

<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: [May 16, 2022, 7:17am UTC](https://discourse.paraview.org/t/suggestion-for-python-savedata-method/9500/3 "2022-05-16T07:17:56Z")

</div>

@Andy_Bauer , I’m a bit confused. Why not saving as .pvti in ParaView directly ?

---

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [May 16, 2022, 12:26pm UTC](https://discourse.paraview.org/t/suggestion-for-python-savedata-method/9500/4 "2022-05-16T12:26:08Z")

</div>

Maybe it’s better to implement changes in VTK. I’m just thinking where I’m encountering the issue, not where best to implement a solution. I talked to @utkarsh.ayachit and @cory.quammen about this but really don’t have a preference as to where the solution should be implemented.

---

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [May 16, 2022, 12:30pm UTC](https://discourse.paraview.org/t/suggestion-for-python-savedata-method/9500/5 "2022-05-16T12:30:32Z")

</div>

Yes, ideally users would save as a .pvti in ParaView. Two reasons this may not happen though:

1. Users may not understand the difference between the .pvti and .vti formats and thus choose poorly (I’ve had a user do this and this is what brought up this issue). In this case when running in parallel the user didn’t understand why the Python trace output worked in serial but not in parallel.
2. The user may want to to have a .vti in serial due to being able to skip writing out the meta-file and the actual data file (possibly in a sub-directory).

---

<div class="post-metadata">

### Author: ![dustin\_weaver](https://discourse.paraview.org/user_avatar/discourse.paraview.org/dustin_weaver/32/12477_2.png) [@dustin\_weaver](https://discourse.paraview.org/u/dustin_weaver)
#### Post date: [September 26, 2023, 7:13pm UTC](https://discourse.paraview.org/t/suggestion-for-python-savedata-method/9500/6 "2023-09-26T19:13:15Z")

</div>

I got around this by saving it as .vtm

For some reason vtk didn’t work with me as well and then I did a trace inside of paraview gui and was able to generate vtk’s using vtm.
