Hello,
I’ve been running into issues with memory consumption when trying to create images for a large set of cases. Some reading suggests the ResetSection() function, which I include in destructor of a wrapper class I wrote for common paraview use cases:
def __del__(self):
# Delete all extracted blocks
blocks = list(self.extractBlocks.keys())
for b in blocks:
Delete(self.extractBlocks[b])
del self.extractBlocks[b]
ResetSession()
However, when I try this, the first case executes fine and performs as I intended, and my new class initializes fine (new pv_session class for each case I want a picture of):
def <constructor>():
self.connection = servermanager.ActiveConnection
self.enReader = EnSightReader(registrationName=self.ensight_casename, CaseFileName=self.ensight_file)
self.enReader.CellArrays = []
self.enReader.PointArrays = variables
self.renderView = GetActiveViewOrCreate('RenderView')
But the code will crash at different parts, like creating a block, or setting the view:
# Extract block
for i,part in enumerate(parts_list):
if part[0:6] != '/Root/':
parts_list[i] = '/Root/'+part
self.extractBlocks[name] = ExtractBlock(registrationName=name, Input=self.enReader)
The code crashes and I get this error:
Traceback (most recent call last):
File "ParaviewSession.py", line 349, in takePicture.py:
layout.SetSize(ImageResolution[0],ImageResolution[1])
AttributeError: 'NoneType' object has no attribute 'SetSize'
Exception ignored in: <function pv_session.__del__ at 0x7f3e78c99160>
Traceback (most recent call last):
File "/nas01/users/m82643/scripts/pybin/paraview/ParaviewSession.py", line 86, in __del__
ResetSession()
File "/nas01/common/gnc/aero/paraview/ParaView-5.11.2-MPI-Linux-Python3.9-x86_64/lib/python3.9/site-packages/paraview/simple.py", line 120, in ResetSession
_initializeSession(connection)
File "/nas01/common/gnc/aero/paraview/ParaView-5.11.2-MPI-Linux-Python3.9-x86_64/lib/python3.9/site-packages/paraview/simple.py", line 2689, in _initializeSession
raise RuntimeError ("'connection' cannot be empty.")
RuntimeError: 'connection' cannot be empty.
I just don’t understand why I am getting an empty connection if I’m resetting the session.
Thank you