[Paraview] Passing a python script parameters

David Doria daviddoria at gmail.com
Tue May 12 14:58:18 EDT 2009


In the python shell, there is a "Run Script" button. It seems that you can
only run scripts that do not require parameters? If I have a python function
in a .py file, how would I call it? In normal python, I would import the
function like this (the listdir was just to show you I was in the correct
directory):

 >>> os.listdir(".")

['IterateOpenSources.py', 'IterateOpenSources.py~', 'LoadMultipleFiles.py',
'LoadMultipleFiles.py~', 'Sphere.py']

>>> from LoadMultipleFiles import *

and here is the contnets of LoadMultipleFiles.py
--------------------------
#!/usr/bin/pvpython
def LoadMultipleFiles(FilePrefix, Low, High):
    #setup paraview connection
    from paraview import servermanager

    if not servermanager.ActiveConnection:
        connection = servermanager.Connect()

    pm = servermanager.ProxyManager()
    #actually do something here
---------------------------

You can see the function requires a couple of parameters - how can I pass
them?

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20090512/6fbd1fb5/attachment.htm>


More information about the ParaView mailing list