【问题标题】:Python script running via shell but not working via supervisordPython脚本通过shell运行但不能通过supervisord运行
【发布时间】:2017-12-05 23:34:24
【问题描述】:

我面临的错误是:

 File "/usr/local/lib/python3.5/dist-packages/oauth2client/crypt.py", line 23, in <module>
    from oauth2client import _pure_python_crypt
  File "/usr/local/lib/python3.5/dist-packages/oauth2client/_pure_python_crypt.py", line 24, in <module>
    from pyasn1_modules.rfc2459 import Certificate
  File "/usr/local/lib/python3.5/dist-packages/pyasn1_modules/rfc2459.py", line 20, in <module>
    from pyasn1.type import opentype
ImportError: cannot import name 'opentype'

认为已按照this stackoverflow answer 中的说明解决:

sudo apt-get --reinstall install python-pyasn1 python-pyasn1-modules
pip3 install --upgrade google-auth-oauthlib

当我通过 supervisorctl 运行我的程序时,sudo supervisorctl restart at_ussd 我得到了上面的错误。 但是当我通过 shell sudo python3 at_ussd.py 运行我的程序时,程序运行顺利。

请帮我解决这个问题,以便我可以继续使用主管进行管理!

【问题讨论】:

    标签: python-3.5 supervisord pyasn1


    【解决方案1】:

    tl;博士;搜索系统上安装的多个 pyasn1/pyasn1-modules 包。

    从追溯看来,您拥有最新的 pyasn1-modules (0.2.1) 和一些较旧(且不兼容)的 pyasn1,例如

    但是,当您从用户 shell 运行程序时,会选择 pyasn1-modules/pyasn1 的兼容组合。它可以是较旧的 pyasn1-modules 或较新的 pyasn1。

    【讨论】:

      猜你喜欢
      • 2021-03-20
      • 1970-01-01
      • 2018-08-15
      • 2011-07-27
      • 2016-03-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多