V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
leven87
V2EX  ›  Python

signal only works in main thread 错误,求解决思路

  •  
  •   leven87 · 2021-10-15 15:45:41 +08:00 · 1979 次点击
    这是一个创建于 895 天前的主题,其中的信息可能已经有所发展或是发生改变。
    我使用 flask 框架启动一个 web 服务,在 http 请求 a 服务时,显示 signal only works in main thread 。

    我尝试使用了 asyncio.run 命令,celery 框架等,启动时取消 debug,加--no-reload 参数等方法,均无效。

    只有当使用 os.system('python a.py &') 时,可以运行。

    当然 a 服务也比较复杂,会调用其他开源框架的程序。

    求教,这样的情况该如何解决最好,真的不能直接函数调用 a(),而要运行系统命令去使用? 再有,使用 celery 难道不是相当于另起一个进程了吗? 怎么还会报错呢。谢谢
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5693 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 06:27 · PVG 14:27 · LAX 23:27 · JFK 02:27
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.