you need to provide your globals to LoadPlugin, so it can add H5PartReader into
the main scope.
Otherwise, you will need to use the full path which should be something
along that
servermanager.sources.H5PartReader
def LoadPlugin(filename, remote=True, ns=None):
"""Loads a ParaView plugin and updates this module with new constructors
if any. The remote argument (default to True) is to specify whether
the plugin will be loaded on client (remote=False) or on server
(remote=True).
If you loaded the simple module with from paraview.simple import *,
make sure to pass globals() as an argument::
LoadPlugin("myplugin", False, globals()) # to load on client
LoadPlugin("myplugin", True, globals()) # to load on server
LoadPlugin("myplugin", ns=globals()) # to load on server
Otherwise, the new functions will not appear in the global namespace."""
On Fri, Aug 12, 2016 at 6:15 AM, 曹智选 <[email protected]> wrote:
> No, I have this in the scripts.
>
> 2016-08-11 19:52 GMT-04:00 Sebastien Jourdain <sebastien.jourdain@kitware.
> com>:
>
>> Are you missing?
>>
>> from paraview.simple import *
>>
>> On Thu, Aug 11, 2016 at 4:10 PM, 曹智选 <[email protected]> wrote:
>>
>>> Hi,
>>> I am trying to write a python scripts to "visualize" simulation results.
>>>
>>> I need load a plugin through GUI of paraview before opening data. If I
>>> first load plugin in the GUI and then run my python scripts through
>>> Paraview GUI -> tools ->python shell, it works well.
>>> To load plugin in python scrips. I use the trace tool of paraview found
>>> that the function to load plugin is:
>>> LoadPlugin('/rohit1/data/users/zhixuanc/Soft/ParaView-4.3.1-
>>> Linux-64bit/lib/paraview-4.3/libH5PartReader.so', remote=False).
>>>
>>> Instead of load plugin manually through GUI, I put this command at the
>>> very beginning of the existing python scripts and run the scripts through
>>> Paraview GUI -> tools ->python shell. But I got an error message and it
>>> does not work:
>>>
>>> Plot[plotname] = H5PartReader(FileName=maindirectory+subdirectory+name)
>>>
>>> NameError: global name 'H5PartReader' is not defined
>>>
>>> But when I go to Paraview GUI -> tools -> Manage Plugins, it shows that
>>> the required plugin is loaded.
>>>
>>> I am not sure what's wrong and how to fix this issue.
>>>
>>> Could anybody give me any advice on it?
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Please keep messages on-topic and check the ParaView Wiki at:
>>> http://paraview.org/Wiki/ParaView
>>>
>>> Search the list archives at: http://markmail.org/search/?q=ParaView
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://public.kitware.com/mailman/listinfo/paraview
>>>
>>>
>>
>
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the ParaView Wiki at:
http://paraview.org/Wiki/ParaView
Search the list archives at: http://markmail.org/search/?q=ParaView
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview