Not understanding where the error in the code?

The error in the code, I can not understand where she is..
Traceback (most recent call last):
 File "v2.py", line 14, in <module>
 for event in add.listen():
 File "C:\Users\DNS\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vk_api\longpoll.py", line 621, in listen
 for event in self.check():
 File "C:\Users\DNS\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vk_api\longpoll.py", line 560, in check
 timeout=self.wait + 10
TypeError: can only concatenate str (not "int") to str


The code itself

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import vk_api
from vk_api.add import VkLongPoll, VkEventType
import random
import time
from datetime import datetime, timedelta

vk_session = vk_api.VkApi(token='Token')
add = VkLongPoll(vk_session, 'group ID')
vk = vk_session.get_api()


for event in add.listen():
 if event.type == VkEventType.MESSAGE_NEW:
 print('the Message came in:' + str(event.datetime + timedelta(hours=3)))
 print('message:' + str(event.text))
print(event.peer_id)

 response = event.text.lower()
 if event.from_chat or event.from_user:
try:
 if response == '/status' or response == '/status':

 today = datetime.strftime(datetime.now(), "%d%m%Y")
 tomorrow = datetime.strftime(datetime.now() + timedelta(days=1), "%d%m%Y")

vk.messages.send(
peer_id=event.peer_id,
 random_id=random.randint(-2147483648, +2147483648),
 message='Only messages in this dialog :' +
 str(vk.messages.search(peer_id=event.peer_id, date=tomorrow, count=1)['count'] + 1) + '\PPA today: '+
 str( vk.messages.search(peer_id=event.peer_id, date=tomorrow, count=1)['count'] + 1 - vk.messages.search(peer_id=event.peer_id, date=today, count=1)['count'] + 1),
)
except:
pass

finally:
 time.sleep(3)


Please explain where they are, and address them.
April 3rd 20 at 17:42
2 answers
April 3rd 20 at 17:44
can only concatenate str (not "int") to str
Sorry, found an error, but I can't solve it. It seems to be well made.... - denis52 commented on April 3rd 20 at 17:47
@denis52using print(type(variable)) check that it is folded. - Lila_Morar12 commented on April 3rd 20 at 17:50
April 3rd 20 at 17:46
timeout=self.wait + 10
here using the plus sign is concatenation (combining strings), as one of the elements passed in a string.
if we want to perform addition, then both terms must be numeric.
will do so:
timeout=int(self.wait) + 10

Find more questions by tags PythonVKontakteBots