Answer the question
In order to leave comments, you need to log in
Launching an EXE file from Python and closing it after a while?
Good afternoon. It is necessary to launch an EXE file using Python, wait until this file performs all the actions (on average, the process takes about an hour) and close this process after a specified time.
Answer the question
In order to leave comments, you need to log in
as I already wrote in the commentary, it depends on what method you have for determining the success of the completion of the EXE-shki. Here is the general pattern:
from os import startfile
from psutil import process_iter
from time import sleep
def is_completed(some_attribute):
#if <your cheking method>: return True
#else: return False
startfile(some_file)
while not is_completed(some_attribute):
sleep(some_time)
for proc in process_iter():
if proc.name() == some_file.split("\\")[-1]:
proc.kill()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question