Oh, I think I error is this: LoadPlugin(.., ns=globals())
The namespace is the 3rd argument for LoadPlugin[1], not second. So either use the proper location, or use the keyword argument. [1] http://www.paraview.org/ParaView3/Doc/Nightly/www/py-doc/paraview.simple.html#paraview.simple.LoadPlugin On Wed, Sep 3, 2014 at 10:13 AM, <[email protected]> wrote: > Thank you for the quick response! > I've tried with other plugins (very simple ones which expose vtkfilters), and > it worked. > I was able to make myfilter() work by restarting the python shell after > loading it (and sometimes also loading it via the LoadPlugin() command). The > strange thing is that if there is some error while running script (for > example, reading empty arrays), then myfile() is not recognized anymore, > unless I restart the python interpreter (not necessarily paraview), but I was > not really able to isolate the issue (I am just restarting the shell to make > it work) > Thank you > > -----Original Message----- > From: Utkarsh Ayachit [mailto:[email protected]] > Sent: 03 September 2014 14:22 > To: Barazzetti, Livia (ISTB) > Cc: ParaView > Subject: Re: [Paraview] Calling a customized xml plugin from python > > I believe you should be accessing it as : > >> myfilter() > > And not servermanager.myfilter. > > On Wed, Sep 3, 2014 at 8:06 AM, <[email protected]> wrote: >> Hi, >> >> >> >> I have saved a paraview state in python format. In the pipeline there >> are a couple of filters coming from an xml plugin (generated in this >> way >> http://www.kitware.com/blog/home/post/534 ). When I try to run the the >> script in the python shell (with the plugin already loaded from the >> gui menu), I get the error “'module' object has no attribute 'myfilter'” . >> >> I have tried also the following commands: >> >> >> >>>>LoadPlugin(“path/to/myfilter.xml”,globals()) >> >>>>servermanager.myfilter >> >> But still I am not able to access it. >> >> If it can help, when I load the pipeline from a pvsm file, the filter >> is correctly loaded. >> >> If I select it and call GetActiveSource, I get: <paraview.servermanager. >> myfilter object at 0x0000000015B40A20> >> >> >> >> What should be the correct command for calling it? >> >> Thank you >> >> >> >> Livia Barazzetti >> Ph.D. Student - Medical Image Analysis Institute for Surgical >> Technology and Biomechanics University of Bern Stauffacherstrasse 78 >> CH-3014 Bern >> Tel +41 31 631 59 48 >> http://www.istb.unibe.ch >> >> >> >> >> _______________________________________________ >> 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 >> >> 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 Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview
