简体   繁体   中英

python3 IDLE3 Flask Socket IO error

yeah so i was using idle, browsing stack overflow, when i came upon this code snippet. Its a basic python flask Socket Io app that does no system calls what soEver. But, for some reason, when i run it IDLE just does a shell restart. when i added a debugging print statement: print(3) , this is the traceback I got * Restarting with stat--- Logging error --- Traceback (most recent call last):Traceback (most recent call last): and nothing after the colen. the following is the code i was trying to run:

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: it runs in terminal correctly

IMPORTANT

Turns out, that it was due to installing gevent

Idk why gevent breaks idle, but i installed it because the socketio output recommended to do so.

well, now you know

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM