[Paraview] Loading a Plugin from a Python-Script in 3.6.1

Jean M. Favre jfavre at cscs.ch
Mon Aug 31 06:42:43 EDT 2009


Bernhard Gschaider wrote:
> Hi!
> 
> I'm trying to update a pvpython-script from 3.4 to 3.6.1
> 
> Amongst other things it should load a Plugin. The plugin loads
> perfectly over the GUI, but when I try to do it from the script it
> fails with this message:
> 
>   File "/home/bgschaid/Development/OpenFOAM/Python/PyFoam/PyFoam/Paraview/ServermanagerWrapper.py", line 41, in __init__
>     servermanager.LoadPlugin(path.join(p,plug1))
>   File "/home/openfoam/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/platforms/linux64Gcc/Utilities/VTKPythonWrapping/paraview/servermanager.py", line 2094, in LoadPlugin
>     if not parser.Parse(f.read()):
> TypeError: function takes exactly 2 arguments (1 given)


the error message indicates that the second argument is missing. Please
try again using the following syntax:

LoadPlugin("yourlibname.so", ns=globals())

this is documented in the source code of
Utilities/VTKPythonWrapping/paraview/simple.py

def LoadPlugin(filename, ns=None):
    """Loads a ParaView plugin and updates this module with new constructors
    if any. If you loaded the simple module with from paraview.simple
import *,
    make sure to pass globals() as the second arguments:
    LoadPlugin("myplugin", globals())
    Otherwise, the new functions will not appear in the global namespace."""


Jean--
Swiss National Supercomputing Center


More information about the ParaView mailing list