vtkCPPythonPipeline::DetectScriptVersion() often doesn't work for Catalyst v1.0 scripts without explicit headers
I recently generated a Catalyst script with ParaView v5.8.1 for which the start of the file looks like:
#--------------------------------------------------------------
# Global timestep output options
timeStepToStartOutputAt=0
forceOutputAtFirstCall=False
# Global screenshot output options
imageFileNamePadding=6
rescale_lookuptable=False
# Whether or not to request specific arrays from the adaptor.
requestSpecificArrays=True
# a root directory under which all Catalyst output goes
rootDirectory=''
# makes a cinema D index table
make_cinema_table=False
#--------------------------------------------------------------
# Code generated from cpstate.py to create the CoProcessor.
# paraview version 5.8.1
#--------------------------------------------------------------
from paraview.simple import *
from paraview import coprocessing
It can be deduced from the line
# paraview version 5.8.1
that this is a v1.0 script but vtkCPPythonPipeline::DetectScriptVersion()
returns 0
(i.e. failure) since it only keeps checking additional lines if they are comment lines or empty (see this part of the definition). In the particular case above, the final else
block is selected and the following is printed to the log
( 1.918s) [pvbatch.0 ]vtkCPPythonPipeline.cxx:182 9| . regex match failed for 'timeStepToStartOutputAt=0'
Of course, I could edit this script by hand and add a line such as
# script version: 1.0
near the top but this doesn't seem necessary given it would be possible to get a regex1
match further down the file. Could this function be modified to keep checking after a line with no regex matches?