CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > ParaView

[General] Close Paraview after python script execution

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 1 Post By taalf
  • 3 Post By wyldckat
  • 1 Post By louisgag

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 7, 2013, 12:51
Default Close Paraview after python script execution
  #1
Member
 
William Tougeron
Join Date: Jan 2011
Location: Czech Republic
Posts: 70
Rep Power: 15
taalf is on a distinguished road
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
Bombacar likes this.
taalf is offline   Reply With Quote

Old   October 11, 2013, 19:20
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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, namsivag and Bombacar like this.
__________________
wyldckat is offline   Reply With Quote

Old   October 14, 2013, 09:19
Default
  #3
Member
 
William Tougeron
Join Date: Jan 2011
Location: Czech Republic
Posts: 70
Rep Power: 15
taalf is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Why not use pvpython or pvbatch?
Why not ?

Indeed, why not !

Exactly what I was looking for

Many many many thanks

Best regards,

William
taalf is offline   Reply With Quote

Old   October 7, 2015, 11:23
Default
  #4
Senior Member
 
louisgag's Avatar
 
Louis Gagnon
Join Date: Mar 2009
Location: Stuttgart, Germany
Posts: 338
Rep Power: 18
louisgag is on a distinguished road
Send a message via ICQ to louisgag
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)
wyldckat likes this.
louisgag is offline   Reply With Quote

Old   August 29, 2019, 22:29
Default
  #5
New Member
 
Zak
Join Date: Aug 2019
Posts: 1
Rep Power: 0
singul4r1ty is on a distinguished road
Sorry to respond even later but this is what came up when I was searching this and I found an even simpler way!

Just import sys and then run sys.exit(0). This closes paraview for me, and the 0 is an OK exit code.
singul4r1ty is offline   Reply With Quote

Reply

Tags
paraview 3.98


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[OpenFOAM] Paraview from python shell : Glew initialization and VTKcommoncorepython error pradyumnsingh ParaView 0 September 18, 2018 14:40
[General] “Upload” vtk data from client to server in paraview script Jack001 ParaView 0 March 8, 2018 08:27
[General] How to write a script to get multiple slices with paraview? kiddmax ParaView 19 November 7, 2016 02:57
[OpenFOAM] Integrate Variables using ParaView Python Shell cfdsolver1 ParaView 0 October 12, 2016 04:08
[OpenFOAM] paraview v4 - building with python - OF2.3.0, PVv4, Python 2.7 aylalisa ParaView 4 June 13, 2014 09:52


All times are GMT -4. The time now is 15:01.