CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   ParaView (https://www.cfd-online.com/Forums/paraview/)
-   -   [OpenFOAM] Image Paraview with Python (https://www.cfd-online.com/Forums/paraview/195976-image-paraview-python.html)

FlyBob91 November 22, 2017 06:23

Image Paraview with Python
 
Hello to all,
my teacher asked me to find a manner to produce a series of images and to automate this procedure because we have to make different test for the colour etc. After a rapid search i (maybe) understand that this could be made by the use of a python script.
I initially built Paraview with OpenFOAM but then i noticed this is an incomplete version because it hadn't let to save .pdf image. So i installed a "stand alone" version and now i wan to to produce an image through a python script.

I test this one find in the web

Code:

from paraview.simple import *
simple.Sphere()
simple.Show()
simple.Render()
simple.WriteImage("foo.png")

but, unfortunatley, when i run this script an errorr occurs and it does not load the module.

Code:

Traceback (most recent call last):
  File "ciao.py", line 2, in <module>
    from paraview.simple import *
ImportError: No module named 'paraview'


i use python3
What's i'm doing wrong?

Thanks for help


All times are GMT -4. The time now is 12:41.