signal only works in main thread


#1

CATCHAT项目中socketio库问题
报错内容

Traceback (most recent call last):
  File "/root/.local/share/virtualenvs/catchat-ztofOoC9/lib/python3.5/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/root/flask/catchat/catchat/__init__.py", line 20, in <module>
    from catchat.blueprints.admin import admin_bp
  File "/root/flask/catchat/catchat/blueprints/admin.py", line 17, in <module>
    from catchat.models import User
  File "/root/flask/catchat/catchat/models.py", line 21, in <module>
    from catchat.extensions import db, login_manager
  File "/root/flask/catchat/catchat/extensions.py", line 19, in <module>
    from flask_socketio import SocketIO
  File "/root/.local/share/virtualenvs/catchat-ztofOoC9/lib/python3.5/site-packages/flask_socketio/__init__.py", line 9, in <module>
    from socketio import socketio_manage
  File "/root/.local/share/virtualenvs/catchat-ztofOoC9/lib/python3.5/site-packages/socketio/__init__.py", line 3, in <module>
    from .client import Client
  File "/root/.local/share/virtualenvs/catchat-ztofOoC9/lib/python3.5/site-packages/socketio/client.py", line 6, in <module>
    import engineio
  File "/root/.local/share/virtualenvs/catchat-ztofOoC9/lib/python3.5/site-packages/engineio/__init__.py", line 3, in <module>
    from .client import Client
  File "/root/.local/share/virtualenvs/catchat-ztofOoC9/lib/python3.5/site-packages/engineio/client.py", line 44, in <module>
    original_signal_handler = signal.signal(signal.SIGINT, signal_handler)
  File "/usr/lib/python3.5/signal.py", line 47, in signal
    handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
ValueError: signal only works in main thread

猜测与soketio有关系,报错来自开发环境,切换到生产模式没有此报错。

看到书上此处,可能有点关系,或者是启动方式不对?


#2

参见这个帖子:


#3

谢谢。