@yapaofficial

Как исправить ошибку при запуске нескольких действий?

вот код в котором происходит ошибка:
from flask import Flask, render_template, request, redirect, url_for, flash, make_response, current_app
from flask_socketio import SocketIO
from flask_sqlalchemy import SQLAlchemy
from telebot import telebot, types
from threading import Thread
from app import *

app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///Coin.db"
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False

socketio = SocketIO(app)
db = SQLAlchemy(app)
bot = telebot.TeleBot(token)

@app.route('/')
def index():
    return render_template('index1.html')


@app.route('/login')
def login():
    return render_template('auth/login.html')


@app.route('/login/<string:token>')
def login_token(token):
    return render_template('auth/login.html')









@bot.message_handler(commands=['start'])
def send_welcome(message):
    keyboard = types.InlineKeyboardMarkup()
    keyboard.add(types.InlineKeyboardButton('Войти', url='http://127.0.0.1:5000/login/slkdjfh97834'))
    bot.send_message(message.chat.id, 'Привет! Добро пожаловать в нашу игру!', reply_markup=keyboard)


if __name__ == "__main__":
    bot_thread = Thread(target=bot.polling)
    bot_thread.start()

    socketio.run(app, debug=True)


сама ошибка

* Restarting with stat
Exception in thread Thread-1 (polling):
Traceback (most recent call last):
  File "D:\files\Python311\Lib\threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "D:\files\Python311\Lib\threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "D:\files\PyCharm\projects\coin\venv\Lib\site-packages\telebot\__init__.py", line 1043, in polling
    self.__threaded_polling(non_stop=non_stop, interval=interval, timeout=timeout, long_polling_timeout=long_polling_timeout,
  File "D:\files\PyCharm\projects\coin\venv\Lib\site-packages\telebot\__init__.py", line 1062, in __threaded_polling
    or_event = util.OrEvent(
               ^^^^^^^^^^^^^
  File "D:\files\PyCharm\projects\coin\venv\Lib\site-packages\telebot\util.py", line 512, in OrEvent
    orify(e, changed)
  File "D:\files\PyCharm\projects\coin\venv\Lib\site-packages\telebot\util.py", line 485, in orify
    e._set = e.set
    ^^^^^^
AttributeError: 'gevent._gevent_cevent.Event' object has no attribute '_set'
 * Debugger is active!
 * Debugger PIN: 140-659-948
Exception in thread Thread-1 (polling):
Traceback (most recent call last):
  File "D:\files\Python311\Lib\threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "D:\files\Python311\Lib\threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "D:\files\PyCharm\projects\coin\venv\Lib\site-packages\telebot\__init__.py", line 1043, in polling
    self.__threaded_polling(non_stop=non_stop, interval=interval, timeout=timeout, long_polling_timeout=long_polling_timeout,
  File "D:\files\PyCharm\projects\coin\venv\Lib\site-packages\telebot\__init__.py", line 1062, in __threaded_polling
    or_event = util.OrEvent(
               ^^^^^^^^^^^^^
  File "D:\files\PyCharm\projects\coin\venv\Lib\site-packages\telebot\util.py", line 512, in OrEvent
    orify(e, changed)
  File "D:\files\PyCharm\projects\coin\venv\Lib\site-packages\telebot\util.py", line 485, in orify
    e._set = e.set
    ^^^^^^
AttributeError: 'gevent._gevent_cevent.Event' object has no attribute '_set'
  • Вопрос задан
  • 46 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы