推荐学习书目
› 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 · Oct 15, 2021 · 3476 views
    This topic created in 1808 days ago, the information mentioned may be changed or developed.
    我使用 flask 框架启动一个 web 服务,在 http 请求 a 服务时,显示 signal only works in main thread 。

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

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

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

    求教,这样的情况该如何解决最好,真的不能直接函数调用 a(),而要运行系统命令去使用? 再有,使用 celery 难道不是相当于另起一个进程了吗? 怎么还会报错呢。谢谢
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2582 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 09:50 · PVG 17:50 · LAX 02:50 · JFK 05:50
    ♥ Do have faith in what you're doing.