you're leaking a dataset with each iteration. You need to
Delete(reader)
del reader
each iteration.
--- original.py 2013-11-08 11:52:45.746871024 -0800
+++ fixleak.py 2013-11-08 11:56:32.226876191 -0800
@@ -15,15 +15,13 @@
while true == 1:
OutPutFile = OutPutLocation+'local_'+str(count).zfill(4)+'.vtk'
-
- while exist == 0:
- try:
- with open(OutPutFile):
- exist = 1
- except IOError:
- exist = 0
- exist = 0
-
+ if os.path.exists(OutPutFile)
+ raise RuntimeError('File %s deosnt exist'%(OutPutFile))
+
+ if reader:
+ Delete(reader)
+ del reader
+
reader = OpenDataFile(OutPutFile)
reader.PointData
@@ -47,13 +45,5 @@
cam.Elevation(30)
cam.Azimuth(30)
Render()
-
+
count = count + 1
-# Stop the script killing itself
- nOutPutFile = OutPutLocation+'local_'+str(count).zfill(4)+'.vtk'
- while exist == 0:
- try:
- with open(nOutPutFile):
- exist = 1
- except IOError:
- exist = 0
On 11/08/2013 10:34 AM, Junyi Han wrote:
Hi,
Thanks for your reply. Below is my script:
'''
Created on 29 Oct 2013
@author: Junyi Han
'''
from paraview.simple import *
PVServer = 'localhost'
OutPutLocation = '/home/johnny/Application/DPD/myDPD-PVersion/'
exist = 0
count = 0
true = 1
Connect(PVServer)
while true == 1:
OutPutFile = OutPutLocation+'local_'+str(count).zfill(4)+'.vtk'
while exist == 0:
try:
with open(OutPutFile):
exist = 1
except IOError:
exist = 0
exist = 0
reader = OpenDataFile(OutPutFile)
reader.PointData
view = GetRenderView()
dp = GetDisplayProperties()
dp.Representation = 'Surface'
readerRep = GetRepresentation()
readerRep.ColorArrayName = 'density_01'
# Force read
reader.UpdatePipeline()
Show(reader)
Render()
# Get a nice view angle
if count == 0:
cam = GetActiveCamera()
cam.Elevation(30)
cam.Azimuth(30)
Render()
count = count + 1
# Stop the script killing itself
nOutPutFile = OutPutLocation+'local_'+str(count).zfill(4)+'.vtk'
while exist == 0:
try:
with open(nOutPutFile):
exist = 1
except IOError:
exist = 0
2013/11/8 Burlen Loring <[email protected] <mailto:[email protected]>>
it sounds like what happens when one leaks datasets, filters, or
other vtk objects that hold large amounts of data. Could you share
your script?
On 11/08/2013 09:55 AM, Junyi Han wrote:
Hi,
I'm using python script to read data files. Render() function is
called as many times as the number of files. I found that after I
call render() for 40 or 50 times, the speed of rendering is very
slow. Is there a way to solve it? Instead of calling Render()
function several times, is there a way to update or re-render?
Best wishes,
Junyi Han
_______________________________________________
Powered bywww.kitware.com <http://www.kitware.com>
Visit other Kitware open-source projects
athttp://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the ParaView Wiki
at:http://paraview.org/Wiki/ParaView
Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the ParaView Wiki at:
http://paraview.org/Wiki/ParaView
Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview