Answer the question
In order to leave comments, you need to log in
How to return back to the code after an error?
Suppose I got
a Traceback error (most recent call last):
File "C:/Users/Worgen/Desktop/bot/test.py", line 17, in
if 138231317 != vk.messages.getLongPollHistory(ts=ts)[ 'messages']['items'][0]["from_id"]:
IndexError: list index out of range
Process finished with exit code 1
How do I return to the code after an error?
Answer the question
In order to leave comments, you need to log in
try:
if 138231317 != vk.messages.getLongPollHistory(ts=ts)['messages']['items'][0]["from_id"]:
# код
except IndexError:
# обработка этой ошибки
except Exception as ex:
# обработка других ошибок
finally:
# учи матчасть
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question