paraview.simple SaveData Paraview 5.6 built on Ubuntu .04

Hello. I hope this problem has been solved. If it has, lob a tomato at me with the url for the fix printed on it. I am using paraview simple. Eclipse is the editor. I am trying to read in ExodusIIData ship it out to a binary vtm file. I get a strange error from the CreateWriter routine that SaveData calls. I got the idea to use SavaData in this manner by using Paraview’s trace log output. Here is the subroutine:

def translateFile (root):

global fileOut

global fileList

global xlateBar

polyDataFile = ExodusIIReader(FileName=fileList)

polyDataFile.ElementVariables = [ accstrain , coherctps , ‘coherence’ , ‘crack’ , elmass , eqps , ‘k_density’ , ‘k_energy’ , ‘k_temp’ , maxp , maxstrain , ‘press’ , ‘status’ , tgrow ]

SaveData(fileOut, proxy=polyDataFile)

Here is the Error:

File “/home/rmoral/Documents/dev/DTRA/PYTHON/Exodus2VTK/mainProg.py”, line 85, in translateFile
SaveData(fileOut, proxy=polyDataFile)
File “/opt/paraview-5.6/lib/python3.6/site-packages/paraview/simple.py”, line 980, in SaveData
writer = CreateWriter(filename, proxy, **extraArgs)
File “/opt/paraview-5.6/lib/python3.6/site-packages/paraview/simple.py”, line 966, in CreateWriter
writer_proxy.UnRegister(None)
AttributeError: ‘NoneType’ object has no attribute ‘UnRegister’

Thanks in advance for any help.

I was able to use SaveData to save out a multiblock dataset to a vtm file.

What is the value of fileOut when you invoke SaveData?

According to the eclipse debugger:
fileOut = str: <_io.TextIOWrapper name=’/mnt/hgfs/rdgslrjm/Desktop/REZ/bart.vtm’ mode=‘w’ encoding=‘UTF-8’>

and

polyDataFile = ExodusIIReader: <paraview.servermanager.ExodusIIReader object at 0x7f7fab7a3390>

Just because these things happen; When I build Paraview using CMAKE what components must I have in order this to work. I still have the build directory and I can check my build options.

Thank you

Okay fixed it on my own. Whenever a Tk file dialog hands you a filename it is wrapped in the _ioTextIOWrapper. So the cure is to hand any method that needs a real string the __ioTextIOWrapper.name property. That is a bonified string of the path to the file.

fileRoot = filedialog.asksaveasfile(parent=root, filetypes=ftypes,
title=“Select a save path and file name”)
fileOut = fileRoot.name # fileOut now has a string of the path

Ah, makes sense. I’m glad it is working for you.