Forums

Question about PythonAnywhere | Constant Script Running

Hey, so I just found this website earlier today and I hope it will satisfy my needs.

To take my script to a very simple level; it will be running some checks every ~15-30 seconds or so. I was wondering if this service is reliable to doing such an act; if so, how would I correctly set up that function?

All I did was upload a file and started a new console with the program. I currently just have a counting file; that is just counting upwards forever. If I uploaded my script that checks some values every ~15-30 seconds is that how I would start running the infinite process. By creating a new console with the script?

Also, will that script reliably run forever or will the console ever crash or timeout? If it does crash or timeout will it auto reboot the script?

I'm simply looking for a basic server to run my loop. If it does crash I simply need to make sure that when the console reboots the program also reboots.

// P.S I'm going to need to install a couple of modules such as Time and BeautifulSoup. How would I approach creating a console that would have those installed? Even if it crashes or anything of that nature

Hi Crypt,

The PythonAnywhere servers are periodically updated, and therefore console tasks can be 'killed'. There is an excellent piece here on how best to do them: https://help.pythonanywhere.com/pages/LongRunningTasks/

Thanks

time is a standard python module (no need to install) and beautifulsoup comes pre-installed. agree with rcs1000- the best way is to setup a long running task on our scheduled task page.