[Paraview] pvpython pass string to Script (Programmable Source)

Mauro Fontana fontana.mauro at gmail.com
Wed Mar 1 15:38:46 EST 2017


Hello

Sorry to bother, but I can't seem to find a way (in the mailing list or the
documentation) to pass a string as some kind of argument to Programmable
Source (using pvpython interpreter). The python "program" needs to load a
custom binary format using numpy.fromfile.

What I've thought is to write a wrapper function. The function should
receive a string as argument and then instantiate a programmable filter and
execute
myscript.replace(random_var_name, myfilename)
MyProgrammableSource.Script = myscript
return MyProgrammableSource

Where random_var_name is the argument of my numpy.fromfile call. But that
doesn't seem very "pythonic". Is there a way to pass a string to the Script
without the .replace hack?

Sorry if this is documented, I couldn't find it.

Cheers,
Mauro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20170301/945cf99b/attachment.html>


More information about the ParaView mailing list