Y
Y
yraron2021-07-19 12:25:08
Python
yraron, 2021-07-19 12:25:08

When creating a telegram bot on PyDroid, an error pops up, what should I do?

Hello, I have a problem. While creating a Telegram bot in Python (using the aiogram library) in the Pydroid android application, I got an error.
The code:

import config
import logging

from aiogram import Bot, Dispatcher, executor, types
 
logging.basicConfig(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)


Mistake:
Traceback (most recent call last):
File "/data/user/0/en.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in
start(fakepyfile,mainpyfile)
File "/data/user /0/en.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start
exec(open(mainpyfile).read(), __main__.__dict__)
File "", line 6, in
File " /data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/logging/__init__.py", line 1997, in basicConfig
raise ValueError('Unrecognised argument(s): % s' % keys)
ValueError: Unrecognized argument(s): level

[Program finished]


I suspect that the aiogram library is not compatible with the Pydroid application.

If anything, the bot code is not mine, but the programmer Howdy Ho™

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Pankov, 2021-07-19
@yraron

Well, here it is written:

ValueError: Unrecognized argument(s): Level

Where do you look for such an argument with your eyes!
And, no, you don’t have to look, because it’s already written where:
File "", line 6, in

...
logging.basicConfig(Level=logging.INFO)
...

Now read the documentation for this function, or see what arguments it has in the source, or go learn python from the beginning. It's too early for you.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question