[Paraview] ParaView Python problem

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Thu Jun 26 07:47:54 EDT 2014


Ah! I think the Python calculator is corrupting the global context
since both, the filter and the main script run within the same Python
interpreter. Is this using pvpython or Python shell in the UI?

On Thu, Jun 26, 2014 at 6:30 AM, Ian Krukow <i.krukow at tu-braunschweig.de> wrote:
> Hi all,
>
> I like to keep different modules apart in python, therefore I use
>     import paraview.simple as pv
> instead of
>     from paraview.simple import *
>
> I never had problems with this, until I included the Python Calculator in my
> script. Whenever I call "pv.Show()" on the Python Calculator, "pv" (my
> ParaView module) is overwritten with some strange function object, and with
> the next call of pv, I get an error. An example script is given below. I am
> using ParaView 4.1.0, Windows binaries.
>
> Now, there are, of course, several possibilities to prevent this from
> happening, but I do not see any reason for this behaviour. Any ideas?
>
> Kind regards
> Ian
>
>
> Example script:
>
> import paraview.simple as pv
>
> sphere = pv.Sphere()
> pv.GetRenderView()
> pv.Show()
>
> pycalc = pv.PythonCalculator()
> pycalc.Expression = 'Normals'
> pycalc.ArrayName = 'Deformation'
> pv.Show()
>
> clip = pv.Clip()
> pv.Show()
> pv.Render()
>
> On the "pv.Clip" call, I get
> AttributeError: 'function' object has no attribute 'Clip'
> It works fine in the GUI's Python Shell
>
>
> --
> Dipl.-Ing. Ian Krukow
> Tel +49 531 391-3673
>
> Technische Universität Braunschweig
> Institut für Statik/SFB 880
> Beethovenstr. 51
> 38106 Braunschweig
> Deutschland
>
> www.statik.tu-braunschweig.de
> sfb880.tu-braunschweig.de
> _______________________________________________
> 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


More information about the ParaView mailing list