Last active
March 9, 2025 10:05
-
-
Save jrosco/d01b28c2f37100bb5278 to your computer and use it in GitHub Desktop.
Restart running python program from inside app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import os | |
def restart_program(): | |
"""Restarts the current program. | |
Note: this function does not return. Any cleanup action (like | |
saving data) must be done before calling this function.""" | |
python = sys.executable | |
os.execl(python, python, * sys.argv) | |
if __name__ == "__main__": | |
answer = raw_input("Do you want to restart this program ? ") | |
if answer.lower().strip() in "y yes".split(): | |
restart_program() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When you have the secrets to survive in a match, the ability to think and strategy to win uno online is always an extremely important factor.