CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   ParaView (http://www.cfd-online.com/Forums/paraview/)
-   -   Close Paraview after python script execution (http://www.cfd-online.com/Forums/paraview/124536-close-paraview-after-python-script-execution.html)

taalf October 7, 2013 11:51

Close Paraview after python script execution
 
Hi all,

I would like to launch Paraview from a bash command so as to execute a script and then exit automatically at the end of the script.

To launch Paraview and execute the script, I use:

Code:

paraview --script=script_name.py
But after the script execution, Paraview stays open...

Does anybody know how to make it close?

Thank you very much for help!

Best regards,

William

wyldckat October 11, 2013 18:20

Greetings William,

Why not use pvpython or pvbatch?

Beyond this, you can try the instructions given here: http://stackoverflow.com/questions/9...python-program

Best regards,
Bruno

taalf October 14, 2013 08:19

Quote:

Originally Posted by wyldckat (Post 456450)
Why not use pvpython or pvbatch?

Why not ?

Indeed, why not ! :D

Exactly what I was looking for :D

Many many many thanks :D

Best regards,

William

louisgag October 7, 2015 10:23

In case someone is reading on and, like me,

1) doesn't have the python-qt4 libraries compatible with his paraview binaries installed, and
2) obtains the desired rendering only using paraview --script and not by using pvpython or pvbatch, for some mysterious reason,

a solution may also be to execute something like this within the python script:

Code:

import subprocess
subprocess.call("kill $(ps aux|grep -e 'paraview --script=./YOUR_SCRIPT_NAME.py'|grep -v grep|awk {'print $2'})", shell=True)



All times are GMT -4. The time now is 18:40.