Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with recent websockets package #250

Open
jiargei opened this issue Jul 20, 2022 · 1 comment
Open

Error with recent websockets package #250

jiargei opened this issue Jul 20, 2022 · 1 comment

Comments

@jiargei
Copy link

jiargei commented Jul 20, 2022

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

@edmaher
Copy link

edmaher commented Dec 29, 2022

The change was made in websockets v 9.0, so version 8.1 is the last one that works by default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants