Error with recent websockets package
jiargei opened this issue · 1 comments
Running hbmqtt I get the following error.
Traceback (most recent call last):
File "/home/mqtt/.local/bin/hbmqtt", line 33, in
sys.exit(load_entry_point('hbmqtt==0.9.6', 'console_scripts', 'hbmqtt')())
File "/home/mqtt/.local/bin/hbmqtt", line 25, in importlib_load_entry_point
return next(matches).load()
File "/usr/lib64/python3.9/importlib/metadata.py", line 77, in load
module = import_module(match.group('module'))
File "/usr/lib64/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/home/mqtt/.local/lib/python3.9/site-packages/scripts/broker_script.py", line 23, in
from hbmqtt.broker import Broker
File "/home/mqtt/.local/lib/python3.9/site-packages/hbmqtt/broker.py", line 15, in
from hbmqtt.session import Session
File "/home/mqtt/.local/lib/python3.9/site-packages/hbmqtt/session.py", line 8, in
from hbmqtt.mqtt.publish import PublishPacket
File "/home/mqtt/.local/lib/python3.9/site-packages/hbmqtt/mqtt/init.py", line 5, in
from hbmqtt.mqtt.packet import (
File "/home/mqtt/.local/lib/python3.9/site-packages/hbmqtt/mqtt/packet.py", line 8, in
from hbmqtt.adapters import ReaderAdapter, WriterAdapter
File "/home/mqtt/.local/lib/python3.9/site-packages/hbmqtt/adapters.py", line 6, in
from websockets.protocol import WebSocketCommonProtocol
ModuleNotFoundError: No module named 'websockets.protocol'
Current Workaround:
sed -i 's/from websockets.protocol import WebSocketCommonProtocol/from websockets.**legacy.**protocol import WebSocketCommonProtocol/' ~/.local/lib/python3.9/site-packages/hbmqtt/adapters.py
The change was made in websockets v 9.0, so version 8.1 is the last one that works by default