Answers for "restart python after crash windows"

2

shutdown/restart windows with python

# This is for a windows operating system
# We will use the os library
import os

# os.system is basically running a cmd command

os.system("shutdown /s") #shutdown
os.system("shutdown /r") #restart
os.system("shutdown /l") #logoff
os.system("shutdown /h") #hibernate

#for a full list of commands, go into Command Prompt and type "shutdown"
Posted by: Guest on September-29-2020
2

python restart script

sys.stdout.flush()
os.execl(sys.executable, 'python', __file__, *sys.argv[1:])
Posted by: Guest on August-06-2021

Python Answers by Framework

Browse Popular Code Answers by Language