2023-07-21 13:29:08 +00:00
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
2024-12-19 12:48:57 +00:00
|
|
|
|
2023-07-21 13:29:08 +00:00
|
|
|
def main():
|
2023-07-27 23:16:26 +00:00
|
|
|
if len(sys.argv) != 1:
|
|
|
|
print("Usage: python restart_script.py")
|
2023-07-21 13:29:08 +00:00
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
# Reload the main script with the original arguments
|
|
|
|
temp_file = "temp_args.txt"
|
|
|
|
if os.path.exists(temp_file):
|
|
|
|
with open(temp_file, "r") as file:
|
|
|
|
args = file.read().split()
|
|
|
|
main_script = "app.py"
|
|
|
|
os.system(f"python {main_script} {' '.join(args)}")
|
|
|
|
os.remove(temp_file)
|
|
|
|
else:
|
|
|
|
print("Error: Temporary arguments file not found.")
|
|
|
|
sys.exit(1)
|
|
|
|
|
2024-12-19 12:48:57 +00:00
|
|
|
|
2023-07-21 13:29:08 +00:00
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|