pythonubuntupython-importautobahnreconnect

Python: import autobahn_autoreconnect causes RuntimeError


I want to use the module autobahn-autoreconnect and it works fine locally with PyCharm. I just install the module with PyCharm and exchange the old ApplicationRunner line with the new one:

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

But when I install it on an Ubuntu server with pip3 install autobahn-autoreconnect and then use just import autobahn_autoreconnect I get the following error:

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

What am I doing wrong?


Solution

  • The following solution worked for me.

    First:

    import txaio
    txaio.use_asyncio()
    

    Second:

    from autobahn_autoreconnect import ApplicationRunner