[Paraview] passing argument to pvpython script

Gena Bug archaerolog at mail.ru
Wed Nov 25 07:11:43 EST 2015


Hi!

I often write simple scripts for pvpython which take one or more 
arguments (usually filenames) and run them so:
$ pvpython myscript.py filename

Till version 5rc1 I parse arguments using simple analysis of sys.argv, 
like this:
{{{
...
import os, sys
from paraview.simple import *
paraview.simple._DisableFirstRenderCameraReset()

if len(sys.argv) < 1:
     sys.exit('One parameter, name of an input file, is mandatory.')
if not os.path.exists(sys.argv[1]):
     sys.exit('Specified file "' + sys.argv[1] + '" does not exists!')

data = OpenDataFile(sys.argv[1])
...
}}}

And this works fine untill I tried new version. In 5rc1 I always get 
Segmentation Fault:
Error running 
"~/ParaView-5.0.0-RC1-Qt4-OpenGL2-Linux-64bit/lib/paraview-5.0/pvpython" 
"myscript.py" "filename"Segmentation fault

Seems, sys module couldn't be imported... Is it problem with rc-version? 
How can I correctly pass arguments to a script?


More information about the ParaView mailing list