2017-03-01 116 views
0

我想使用模塊autobahn-autoreconnect,它在PyCharm本地工作正常。我剛剛安裝與PyCharm模塊和交換與新老ApplicationRunner行:Python:導入autobahn_autoreconnect導致RuntimeError

# 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() 

我在做什麼錯?

回答

0

以下解決方案適用於我。

第一:

import txaio 
txaio.use_asyncio() 

二:

from autobahn_autoreconnect import ApplicationRunner