【问题标题】:Flask. Socket-io with gevent: [TypeError: 'module' object is not callable]烧瓶。带有 gevent 的 Socket-io:[TypeError: 'module' object is not callable]
【发布时间】:2020-08-05 21:44:32
【问题描述】:

我正在尝试使用 gevent 使用 socket-io 执行烧瓶应用程序,但在启动时收到错误:

uwsgi[23312]: WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x5645e3bee6a0 pid: 23312 (default app)
uwsgi[23312]: spawned uWSGI master process (pid: 23312)
uwsgi[23312]: spawned uWSGI worker 1 (pid: 23315, cores: 1024)
uwsgi[23312]: spawned uWSGI worker 2 (pid: 23316, cores: 1024)
uwsgi[23312]: spawned uWSGI worker 3 (pid: 23317, cores: 1024)
uwsgi[23312]: spawned uWSGI worker 4 (pid: 23318, cores: 1024)
uwsgi[23312]: spawned uWSGI worker 5 (pid: 23319, cores: 1024)
uwsgi[23312]: spawned uWSGI worker 6 (pid: 23320, cores: 1024)
uwsgi[23312]: spawned uWSGI worker 7 (pid: 23321, cores: 1024)
uwsgi[23312]: *** running gevent loop engine [addr:0x5645e2778d30] ***
uwsgi[23312]: TypeError: 'module' object is not callable
uwsgi[23312]: TypeError: 'module' object is not callable
uwsgi[23312]: TypeError: 'module' object is not callable
uwsgi[23312]: spawned uWSGI worker 8 (pid: 23322, cores: 1024)
uwsgi[23312]: spawned uWSGI worker 9 (pid: 23323, cores: 1024)
uwsgi[23312]: TypeError: 'module' object is not callable
uwsgi[23312]: TypeError: 'module' object is not callable
uwsgi[23312]: spawned uWSGI worker 10 (pid: 23324, cores: 1024)
uwsgi[23312]: TypeError: 'module' object is not callable
uwsgi[23312]: TypeError: 'module' object is not callable
uwsgi[23312]: TypeError: 'module' object is not callable
uwsgi[23312]: TypeError: 'module' object is not callable
uwsgi[23312]: TypeError: 'module' object is not callable
uwsgi[23312]: TypeError: 'module' object is not callable
uwsgi[23312]: TypeError: 'module' object is not callable
uwsgi[23312]: TypeError: 'module' object is not callable
uwsgi[23312]: TypeError: 'module' object is not callable
uwsgi[23312]: TypeError: 'module' object is not callable

我的 uwsgi_conf.ini 很简单,只有这几行很重要:

http-websockets = true
http-socket = :1234
chmod-socket = 660
gevent = 1024

当我删除 gevent 行时,一切正常,没有 TypeError: 'module' object is not callable 错误

我在另一台服务器上也有这个项目的 1:1 副本,一切都运行良好

更新-1: gevent-early-monkey-patch = 1 如果我删除这一行,我会得到不同的错误:

Respawned uWSGI worker 1 (new pid: 26039)
DAMN ! worker 3 (pid: 26030) died :( trying respawn ...

【问题讨论】:

    标签: python sockets flask socket.io flask-socketio


    【解决方案1】:

    当我安装时 pip install gevent==1.4.0

    一切都很完美,而不是新的一个 gevent 版本

    【讨论】:

    • 我还注意到最新的 gevent 在 Python 3.7 上运行良好,但在 3.8 上显示错误。
    猜你喜欢
    • 2018-03-31
    • 2019-04-07
    • 1970-01-01
    • 1970-01-01
    • 2020-12-31
    • 1970-01-01
    • 2021-07-29
    • 1970-01-01
    • 2020-03-27
    相关资源
    最近更新 更多