Praxis_Bot/utilities_script.py
2020-12-08 07:02:10 -05:00

44 lines
1.1 KiB
Python

import os
import sys
import psutil
import subprocess
import platform
clearScreen = lambda: os.system('cls' if os.name == 'nt' else 'clear')
def get_args(text: str) -> list:
return text.split(" ")
def hard_shutdown():
current_system_pid = os.getpid()
ThisSystem = psutil.Process(current_system_pid)
ThisSystem.terminate()
def restart_self():
#current_system_pid = os.getpid()
#os.startfile("python C:/praxis/main.py")
#subprocess.run("python C:/praxis/main.py")
#subprocess.call("python main.py", shell=True)
if platform.system() == 'Windows':
os.system('start cmd /k python main.py')
hard_shutdown()
if platform.system() == 'Linux':
os.system('python main.py')
hard_shutdown()
#os.system('python twitch_script.py')
#os.system('python discord_script.py')
def restart_target():
pass
def launch_target(inputScript: str):
cmd = "start cmd /k python " + inputScript
os.system(cmd)
if __name__ == "__main__":
#pass
restart_self()