Answer the question
In order to leave comments, you need to log in
Why does google cloud stop a python program?
Hello.
I am using google cloud for my telegram bot. And I thought that if you run the bot on the google cloud, and then just leave it turned on, then the program will work all the time.
But alas, no, after an hour and a half, the program simply closes, and it is not in the processes either (python).
I checked the program at home, bot.polling()
I put it in while True
, and even if something is wrong with the bot, the process does not end.
Am I doing something wrong, or is google (or debian) really just ending processes somehow?
Answer the question
In order to leave comments, you need to log in
You need to install screen to run in the background.
sudo apt-get install screen
Next, write to the console
screen
, press the enter button 2-3 times and start the bot, then just close ssh or whatever you have there. everything should work.
There is also a possibility that your program is getting exceptions. Try try except, at least without specific exceptions, and log it to a file.
Tipo
try:
////твой код
except Exception as e:
file = open('log.txt', 'a')
file.write(str(e))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question