Answer the question
In order to leave comments, you need to log in
When writing a code for a telegram bot, an error pops up. What to do?
The code:
import config
import logging
from aiogram import Bot, Dispatcher, executor, types
logging.basicCongig(level=logging.INFO)
bot = Bot(token=config.TOKEN)
dp = Dispatcher(bot)
@dp.message_handler()
async def echo(message: types.Message):
await message.answer(message.text)
if __name__ == "__main__":
executor.start_polling(dp, skip_updates=True)
async def echo(message: types.Message):
^
SyntaxError: invalid syntax<
Answer the question
In order to leave comments, you need to log in
Async was introduced starting with python 3.3, version needs to be updated
Still need to install asyncio: pip install asyncio
async/await became available starting from version 3.5, so instead of async is used @asyncio.coroutine
, and instead of await -yield from
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question