When I try to run the example code, I've got this error :
Traceback (most recent call last):
File "app.py", line 106, in
socketio.run(app)
File "/usr/local/lib/python2.7/dist-packages/flask_socketio/init.py", line 244, in run
self.server = socketio.Server(**self.server_options)
AttributeError: 'module' object has no attribute 'Server'
So I checked and it seems that my socketio module don't have Server :
import socketio
dir(socketio)
['builtins', 'doc', 'file', 'name', 'package', 'path', 'version', 'gevent', 'log', 'logging', 'socketio_manage']
am I missing something here?
Yes, I think you have the dependencies of the 0.x versions of this extension installed in your virtualenv, but now you are using the 1.0a1 release.
I recommend that you create a different virtualenv for testing 1.0, the dependencies are all different. You can see what changed in the docs from the v1.0 branch.
Shame on me... I did not used virtualenv. I just read a tutorial on virtualenv and used it. It works fine. Thanks!
For others doing the upgrade from flask-socketio 0.6 -> 1.0x, I ran into this issue and resolved by removing the dependencies first before doing the upgrade:
pip uninstall gevent-socketio
pip uninstall gevent-websocket
pip uninstall gevent
# Now do the upgrade
pip install flask-socketio==1.0b1
How about this one ?
Traceback (most recent call last):
File "main.py", line 224, in <module>
main = Main()
File "main.py", line 37, in __init__
self.start_flask()
File "main.py", line 43, in start_flask
self.flask.run()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 827, in run
from werkzeug.serving import run_simple
File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 70, in <module>
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
File "/usr/lib/python2.7/BaseHTTPServer.py", line 102, in <module>
class HTTPServer(SocketServer.TCPServer):
AttributeError: 'module' object has no attribute 'TCPServer'
@misiek303 Do you have a module called SocketServer in your application by any chance? That might be shadowing the real SocketServer, which is in the Python standard library. Renaming your module to something else would be the solution, if that is your problem.
Bingo ! Thank you!
Most helpful comment
For others doing the upgrade from flask-socketio 0.6 -> 1.0x, I ran into this issue and resolved by removing the dependencies first before doing the upgrade: