[英]python3 IDLE3 Flask Socket IO error
是的,所以当我遇到此代码段时,我正在使用空闲状态,浏览堆栈溢出。 它是一个基本的python flask Socket Io应用程序,没有系统调用soEver。 但是,由于某种原因,当我运行它IDLE时,shell才会重启。 当我添加一个调试打印语句: print(3)
,这是我得到的回溯* Restarting with stat--- Logging error --- Traceback (most recent call last):Traceback (most recent call last):
之后没有任何内容科伦。 以下是我尝试运行的代码:
from flask import Flask, render_template
from flask_socketio import SocketIO, emit
print(3)
app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app)
@socketio.on('connect')
def connect():
emit('message', {'hello': "Hello"})
@app.route('/')
def index():
return render_template('index.html')
socketio.run(app, debug=True)
PS:它在终端中正确运行
重要
原来,这是由于安装了gevent
idk为什么gevent会中断空闲,但是我安装了它,因为建议使用socketio输出。
好吧,现在你知道
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.