generate functionSat, 12 Nov 2022

Check if the program "qbe-instance1.exe" is running, if not, launch it in 30 seconds.

from time import sleep import os import psutil def check_qbe_running(qbe_exe_path): qbe_proc = "qbe-instance1.exe" if not qbe_exe_path.endswith('/'): qbe_exe_path += '/' qbe_exe = os.path.join(qbe_exe_path, qbe_proc) for proc in psutil.process_iter(): if proc.name() == qbe_proc: return True print "QBE not running, wait for 30 seconds and launch QBE." sleep(30) os.system(qbe_exe) return False

Questions about programming?Chat with your personal AI assistant