T
T
taxi_228_xach_2282022-03-31 14:59:55
Python
taxi_228_xach_228, 2022-03-31 14:59:55

How to make the telegram bot restart on errors, python?

How to make the telegram bot restart on errors, python?
I use the pip pyTelegramBotAPI library

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene Wolf, 2022-03-31
@taxi_228_xach_228

If I understood your question correctly, some unhandled error occurs in your program, as a result of which it "crashes" (ends) and you need to start it again. If so, then there are several options:

  • Wrap all code that raises an error in a try/except handler

Or, if for some reason this is not possible (for example, after this error, the program crashes), you can use the following options:
  • Supervisor program - allows you to (re-)run programs and control their work (if I'm not mistaken, this thing is also written in Python)
  • Create your own service - which, in my opinion, is more convenient and most likely will not require the installation of additional software, but will require administrator rights in the system

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question