0

So, i wrote a code that pretty much send a request to website and check for something and if conditions is change it sending email to me.

Code work perfectly fine except one thing, it stop by at self after 2-3 hours of working without any errors. I put everything in while loop. I made exe file and still same issue.

Is it possible to run python code forever ? if not, what languages should i use for that?

NoNam4
  • 457
  • 1
  • 4
  • 12
  • 1
    Possible duplicate of https://stackoverflow.com/questions/20170251/how-to-run-the-python-program-forever – AmitVardhan Dec 24 '20 at 06:15
  • 1
    Please post the code, as you might have a bug in your code where you are forgetting to close handles, or keep building up lists in memory, or you get an unhandled exception, etc. Or just use a script file that restarts the program when it exits - here is [ways to do it on Linux](https://stackoverflow.com/q/298760/1270789). – Ken Y-N Dec 24 '20 at 06:21
  • What you are describing should work assuming your start your loop with `while True:` As Keny Y-N mentioned, we need more information to help solve the problem. – Polkaguy6000 Dec 24 '20 at 06:33
  • code should works forever - but it depends what you do in this loop. But on Linux better method is to use scheduler `cron` to execute program periodically (and then it doesn't need loop. Other method is to start program with [Supervisor](http://supervisord.org/) which will check if program is still running and eventually it will start it again. – furas Dec 24 '20 at 06:37

0 Answers0