Answer the question
In order to leave comments, you need to log in
The bot used to work, but now it gives a strange error, what should I do?
All Tabs are observed, why they are not displayed here I don’t know(
Please help
Code:
from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher
from aiogram.utils import executor
from config import TOKEN
from aiogram.types import ReplyKeyboardRemove, \
ReplyKeyboardMarkup, KeyboardButton, \
InlineKeyboardMarkup, InlineKeyboardButton
bot = Bot(token='TOKEN')
dp = Dispatcher(bot)
@dp.message_handler(commands=['start'])
async def process_start_command(message: types.Message):
await message.answer_sticker(r' https://tlgrm.ru/_/stickers/061/2ac/0612acc2-f6fd-... ')
await message.reply("Hi!\nI'm Valera! We can chat. \nIf you want to know what I can write \n/help ")
@dp.message_handler(commands=['help'])
async def process_help_command(message: types.Message):
await message.answer_sticker(r' https://cdn.tlgrm.ru/stickers/6c6/a9c/6c6a9c5e-acb... ')
await message.reply("Write me something\nP. s. If you are a friend or relative of the creator, write your name.")
@dp.message_handler(content_types=['text'])
async def main(message : types.Message):
if message.text == 'Hello':
await message.answer_sticker(r' https://cdn.tlgrm.ru/stickers/6c6/a9c/6c6a9c5e-acb... ')
item1 = KeyboardButton('Nice')
item2 = KeyboardButton('Fine')
item3 = KeyboardButton('Bad')
markup=ReplyKeyboardMarkup(resize_keyboard=True).add(item1, item2,item3)
await message.reply('Hi amigo, how are you?', reply_markup=markup )
Error:
I watched pip list everything seems to be downloaded.
Traceback (most recent call last):
File "C:\Python\Valera.py", line 1, in
from aiogram import Bot, types
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib \site-packages\aiogram\__init__.py", line 6, in
import asyncio
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\asyncio\__init__.py", line 8, in
from .base_events import *
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 18, in
import concurrent.futures
File "C:\Users\user\AppData\Local\Programs \Python\Python39\lib\concurrent\futures\__init__.py", line 8, in
from concurrent.futures._base import (FIRST_COMPLETED,
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib \concurrent\futures\_base.py", line 7, in
import logging
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py", line 26, in
import sys , os, time, io, re, traceback, warnings, weakref, collections.abc
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\traceback.py", line 5,in
import linecache
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\linecache.py", line 11, in
import tokenize
File "C:\Users\user\AppData\Local\Programs\Python\Python39 \lib\tokenize.py", line 35, in
from token import EXACT_TOKEN_TYPES
ImportError: cannot import name 'EXACT_TOKEN_TYPES' from 'token' (C:\Python\token.py)
Answer the question
In order to leave comments, you need to log in
rename token.py to something else (for example, to main.py), since the module with this name is present in the standard distribution of python.
ImportError: cannot import name 'EXACT_TOKEN_TYPES' from 'token' (C:\Питон\token.py)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question