SHARE
TWEET

Untitled

a guest Jan 18th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import psutil
  2.  
  3. def checkIfProcessRunning(processName):
  4.  
  5. for proc in psutil.process_iter():
  6.     try:          
  7.         if processName.lower() in proc.name().lower():
  8.             return True
  9.     except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
  10.         pass
  11. return False;
  12.  
  13. if checkIfProcessRunning('discord'):
  14.   print('Discord is running')
  15. else:
  16.   print('Discord is NOT running')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top