@@ -1371,25 +1371,34 @@ end subroutine matrix_to_string
13711371! If user specifies a Python file name, then the file is kept, otherwise
13721372! a temporary filename is used, and the file is deleted after it is used.
13731373
1374- subroutine execute (me , pyfile , istat , python )
1374+ subroutine execute (me , pyfile , istat , python , wait )
13751375
13761376 class(pyplot), intent (inout ) :: me ! ! pytplot handler
13771377 character (len=* ), intent (in ), optional :: pyfile ! ! name of the python script to generate
13781378 integer , intent (out ),optional :: istat ! ! status output (0 means no problems)
13791379 character (len=* ), intent (in ),optional :: python ! ! python executable to use. (by default, this is 'python')
1380+ logical , intent (in ),optional :: wait ! ! if true, will wait for the python process to
1381+ ! ! finish before continuing. (default is true).
13801382
13811383 integer :: iunit ! ! IO unit
13821384 character (len= :), allocatable :: file ! ! file name
13831385 logical :: scratch ! ! if a scratch file is to be used
13841386 integer :: iostat ! ! open/close status code
13851387 character (len= :), allocatable :: python_ ! ! python executable to use
1388+ logical :: wait_ ! ! whether to wait for the python process to finish
13861389
13871390 if (allocated (me% str)) then
13881391
13891392 if (present (istat)) istat = 0
13901393
13911394 scratch = (.not. present (pyfile))
13921395
1396+ if (present (wait)) then
1397+ wait_ = wait
1398+ else
1399+ wait_ = .true.
1400+ end if
1401+
13931402 ! file name to use:
13941403 if (scratch) then
13951404 file = trim (tmp_file) ! use the default
@@ -1431,9 +1440,9 @@ subroutine execute(me, pyfile, istat, python)
14311440 ! run the file using python:
14321441 if (file (1 :1 )/= ' "' ) then
14331442 ! if not already in quotes, should enclose in quotes
1434- call execute_command_line(python_// ' "' // file// ' "' )
1443+ call execute_command_line(python_// ' "' // file// ' "' , wait = wait_ )
14351444 else
1436- call execute_command_line(python_// ' ' // file)
1445+ call execute_command_line(python_// ' ' // file, wait = wait_ )
14371446 end if
14381447
14391448 if (scratch) then
0 commit comments