Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
If open program means "is there an application process running", then this can be checked by getting a list of all running processes using psutil:
https://psutil.readthedocs.io/en/latest/#functions
Sending a signal 0 to pid will throw an OSError exception if pid is not running and will do nothing otherwise.
import os
def check_pid(pid):
""" Check For the existence of a unix pid. """
try:
os.kill(pid, 0)
except OSError:
return False
else:
return True
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question