When using python script, screenshot records blank

My purpose is to do some batch processing, and take screen shots.
Here is the script.

#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'

# create a new 'Legacy VTK Reader'

filename = '/root/Documents/huiyi/odb/100-100-30-s-p/frame32-300.0.vtk'

vtk1 = LegacyVTKReader(FileNames=[filename])
renderView1 = GetActiveViewOrCreate('RenderView')

threshold = []
thresholdDisplay = []

n = 0
threshold[n].Scalars = ['CELLS', 'modePE']
threshold[n].ThresholdRange = [2.0, 2.0]
thresholdDisplay.append(Show(threshold[n], renderView1))
thresholdDisplay[n].Representation = 'Surface'
ColorBy(thresholdDisplay[n], ('CELLS', 'modePE'))
thresholdDisplay[n].RescaleTransferFunctionToDataRange(True, False)
thresholdDisplay[n].SetScalarBarVisibility(renderView1, True)

modePELUT = GetColorTransferFunction('modePE')
modePELUT.RescaleTransferFunction(0.0, 26.0)
modePEPWF = GetOpacityTransferFunction('modePE')
modePEPWF.RescaleTransferFunction(0.0, 26.0)

renderView1.CameraPosition = [50.0, 50.0, 294.28455359756214]
renderView1.CameraFocalPoint = [50.0, 50.0, 15.0]
renderView1.CameraParallelScale = 72.2841614740048

SaveScreenshot('/root/Documents/huiyi/odb/100-100-30-s-p/demo.png', renderView1, ImageResolution=[716, 452],
    # PNG options

With above codes, I can get what I want in the window but nothing in the .png file.

It’s also weird that after code finishing, the Apply button is highlighted and the file --> save screenshot is deactivated.

Below is the disappointing .png

I wonder how to fix it.


By the way, I also wanna to know the PYTHONPATH setting of my version.
It seems that I can’t find any existing path like those in former answers.
My OS is Centos 7.
My Paraview is ParaView-5.6.0-RC2-Qt5-MPI-Linux-64bit.

this sounds a lot like issue.

For 5.6, the only workaround, I’m afraid, is to either use pvpython to play back the script or capture the screenshot separately after playing back the script. This is fixed in upcoming 5.7 release.

That means if I use elder versions, such as 5.5.
The problem also no longer exists, right?

That I do not know; worth a shot.

Okay, the 5.5.2 works well.
Thank you!

that is correct. the problem has been fixed in master and will be included in upcoming 5.7 release.

Another problem bothers me.

Here are two pics.

I took shot with the same script, but the color bar is different.

I can only shot color bars like the first one, of which the color bar is too big.

How can I fix it?