Синтаксическая ошибка, нужна ваша помощь.
Не компилируется программа.
По причине : синтаксическая ошибка.
Я её не могу заметить.
Помогите найти и исправить.
Ошибка (SyntaxError: invalid syntax) в 19строке, и если кто-то нашёл еще ошибки, если можете исправить - исправьте - буду благодарен.
1.#-----------------------#
2.#Import-Modules.
3.import requests
4.from vk_api.longpoll import VkLongPoll, VkEventType
5.import vk_api
6.import data
7.from datetime import datetime
8.#Import-Modules.
9.#-----------------------#
10.#Connect to your account with VkApi
11.session = requests.Session()
12.login, password = '*****', *******'
13.vk_session = vk_api.VkApi(login, password)
14.try:
15. vk_session.auth(token_only=True)
16.#Connect to your account with VkApi
17.#-----------------------#
18.#Connect to LongPoll and create LongPoll session.
19.
20.longpoll = VkLongPoll(vk_session)
21.
22.vk = vk_session.get_api()
23.
24.#Connect to LongPoll and create LongPoll session.
25.#-----------------------#
26.#Events |
27.
28
29.while True:
30.for event in longpoll.listen():
31. if event.type == VkEventType.MESSAGE_NEW and event.to_me and event.text:
32.print("Сообщение пришло в : " + st(datetime.strftime(datetime.now(), "%H:%M:%S")))
33.print("Текст Сообщение : " + str(event.text))
34.
try: не может идти без except или finall. Можешь написать так:
try:
# твой код
except: pass