Hey, how would you go about restarting a program by code, I dont mean just clearning the variables, I mean really closing and rerunning the program?
I know this isnt the best way to “clean” out what your program, but I find that it sorta is when it comes to just restarting over with a new plate then one you just just clean after doing a little painting:P Or sorta like when your computer starts to hag down the longer it runs till you just restart it and it runs fine again (cus you flash the ram and w/e else that was going on).
restarting a computer will only help you if you’r on windows. most other OS’es tend to run quite well even after days,weeks and years of continous operation. so does panda (unless you do something that leaks memory).
an “easy” way to restart your application would be to have 2 python instances running. one would be your actual application. the other one would be a small python applicatoin which just starts your application in a seperate thread and checks if it was closed or still running. you could send a simple command via a socket to the controlling python instance to tell it if you want to restart the app upon exit. or if it should shutdown entirely.
there might be better ways. ways better ways. propably lot simpler ones. but its 1:30 am so dont blame me if my brain cant come up with them right now.
adr, I bet you’ll find interesting this section of the python manual
If what you want is shutting down python and rerun :
os.execl(sys.executable, ’ “%s”’%sys.argv)