【问题标题】:Python: import autobahn_autoreconnect causes RuntimeErrorPython:导入 autobahn_autoreconnect 导致 RuntimeError
【发布时间】:2017-07-21 04:07:44
【问题描述】:

我想使用模块autobahn-autoreconnect,它可以在本地与 PyCharm 一起正常工作。我只是用 PyCharm 安装模块并将旧的 ApplicationRunner 行替换为新的:

# from autobahn.asyncio.wamp import ApplicationRunner
from autobahn_autoreconnect import ApplicationRunner

但是当我使用 pip3 install autobahn-autoreconnect 将它安装在 Ubuntu 服务器上然后只使用 import autobahn_autoreconnect 时,我收到以下错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/autobahn_autoreconnect/__init__.py", line 31, in <module>
    from autobahn.wamp import protocol
  File "/usr/local/lib/python3.5/dist-packages/autobahn/wamp/protocol.py", line 272, in <module>
    class ApplicationSession(BaseSession):
  File "/usr/local/lib/python3.5/dist-packages/autobahn/wamp/protocol.py", line 277, in ApplicationSession
    log = txaio.make_logger()
  File "/usr/local/lib/python3.5/dist-packages/txaio/_unframework.py", line 43, in _throw_usage_error
    "To use txaio, you must first select a framework "
RuntimeError: To use txaio, you must first select a framework with .use_twisted() or .use_asyncio()

我做错了什么?

【问题讨论】:

    标签: python ubuntu python-import autobahn reconnect


    【解决方案1】:

    以下解决方案对我有用。

    第一:

    import txaio
    txaio.use_asyncio()
    

    第二:

    from autobahn_autoreconnect import ApplicationRunner
    

    【讨论】:

      猜你喜欢
      • 2013-05-17
      • 1970-01-01
      • 2019-04-14
      • 2014-05-09
      • 1970-01-01
      • 1970-01-01
      • 2016-07-01
      • 2019-06-06
      • 1970-01-01
      相关资源
      最近更新 更多