isra17 / autobahn-autoreconnect

Python Autobahn runner with auto-reconnect feature
GNU General Public License v2.0
19 stars 10 forks source link

Python: import autobahn_autoreconnect causes RuntimeError #17

Closed ghost closed 7 years ago

ghost commented 7 years ago

When I install it on Ubuntu + Python 3.5 with pip3 install autobahn-autoreconnect and then use 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?

ghost commented 7 years ago

The following solution worked for me.

First:


import txaio
txaio.use_asyncio()

Second:

from autobahn_autoreconnect import ApplicationRunner

isra17 commented 7 years ago

I fixed the example from 2a9d32541a2bec22e6d4ffc11f581db29841837e Thanks for the report!