• celery 错误相关:Monkey-patching not on the main thread; threading.main_thread().join() will hang from a greenlet


    /Users/wangpingyang/.pyenv/versions/3.7.2/lib/python3.7/site-packages/httprunner/__init__.py:5: MonkeyPatchWarning: Monkey-patching outside the main native thread. Some APIs will not be available. Expect a KeyError to be printed at shutdown.
      import gevent.monkey;gevent.monkey.patch_all()
    /Users/wangpingyang/.pyenv/versions/3.7.2/lib/python3.7/site-packages/httprunner/__init__.py:5: MonkeyPatchWarning: Monkey-patching not on the main thread; threading.main_thread().join() will hang from a greenlet
      import gevent.monkey;gevent.monkey.patch_all()
    /Users/wangpingyang/.pyenv/versions/3.7.2/lib/python3.7/site-packages/httprunner/__init__.py:5: MonkeyPatchWarning: Monkey-patching ssl after ssl has already been imported may lead to errors, including RecursionError on Python 3.6. It may also silently lead to incorrect behaviour on Python 3.7. Please monkey-patch earlier. See https://github.com/gevent/gevent/issues/1016. Modules that had direct imports (NOT patched): ['urllib3.contrib.pyopenssl (/Users/wangpingyang/.pyenv/versions/3.7.2/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py)']. 
      import gevent.monkey;gevent.monkey.patch_all()

    方法一
    import gevent.monkey;gevent.monkey.patch_all(thread=False)

    方法二
    <pythonpath>/Users/wangpingyang/.pyenv/versions/3.7.2/lib/python3.7/site-packages</pythonpath>

    方法三


     
    B2206B5D80C227FC45F04A5EF92816A2.png

    方法四
    直接将Python版本更换为3.6版本

    注意:我是在celery中调用多协程的任务,最后错误消失,但没有办法运行任务,改为多线程后,可以运行了
    作者:沈宥
    链接:https://www.jianshu.com/p/fb8a9ee7a349
    来源:简书
    著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
  • 相关阅读:
    个人理解的块状格式化上下文
    行框与浮动与清除浮动
    关于offset,scroll,position
    C++常用字符串操作和UTF-8和GBK之间的转换以及判定(转)
    MFC使用LoadBitmap方法加载位图文件失败解决方案(转)
    MFC在子线程中创建窗口(PostMessage方法)
    MFC线程间消息传递(转)
    MFC对话框常用操作文章收藏
    C++ 跨dll传递string类型参数执行出错问题
    C++ windows API函数末尾A和W的意义(转)
  • 原文地址:https://www.cnblogs.com/qiu-hua/p/13024322.html
Copyright © 2020-2023  润新知