2

question i have made a discord bot and occasionally this errors out and these errors can not be stopped, i was wondering if there is a way to restart the scrip when it errors Much Appreciated I am on a windows pc

  • why not just something like `while True: try ... except: pass`? – ingvar Mar 12 '19 at 19:40
  • thing is i dont know what the error can be and the scrip like full on stops so i do need like an external scrip that can read this and restart the bot script – STuart Harper Mar 12 '19 at 19:53
  • https://stackoverflow.com/questions/696839/how-do-i-write-a-bash-script-to-restart-a-process-if-it-dies – ingvar Mar 12 '19 at 19:54

1 Answers1

0

I would use something like:

try:
    *some code*
except Error1, Error2, Error3:
    pass

That should work. I would just add in the errors you get, and when you get a new one, put it in the code.

Hope this helps!

Jack H.
  • 115
  • 10