Fitblip/wsstat

ModuleNotFoundError: No module named 'websockets.handshake'

Opened this issue · 7 comments

Traceback (most recent call last):
File "/usr/local/bin/wsstat", line 7, in
from wsstat.main import wsstat_console
File "/usr/local/lib/python3.6/dist-packages/wsstat/main.py", line 5, in
from wsstat.clients import WebsocketTestingClient
File "/usr/local/lib/python3.6/dist-packages/wsstat/clients.py", line 14, in
import websockets.handshake

Seems like this project doesnt support python 3.6. Ive tested it in 3.8 and had the same error. Retested it in 3.5 and it worked

I'm on 3.5 and instead of the websockets.handshake error I get this:

Traceback (most recent call last):
  File "z:\anaconda3\envs\websocket\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "z:\anaconda3\envs\websocket\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "Z:\anaconda3\envs\websocket\Scripts\wsstat.exe\__main__.py", line 4, in <module>
  File "z:\anaconda3\envs\websocket\lib\site-packages\wsstat\main.py", line 5, in <module>
    from wsstat.clients import WebsocketTestingClient
  File "z:\anaconda3\envs\websocket\lib\site-packages\wsstat\clients.py", line 13, in <module>
    import websockets
  File "z:\anaconda3\envs\websocket\lib\site-packages\websockets\__init__.py", line 1, in <module>
    from .imports import lazy_import
  File "z:\anaconda3\envs\websocket\lib\site-packages\websockets\imports.py", line 90
    f"{package}.{name} is deprecated",
                                    ^
SyntaxError: invalid syntax

Any ideas?

The error was caused by F-string being invalid syntax. Seems like one of the dependencies is probably too high a version. Make sure you're using virtual environments. Something like this https://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/20/conda/ for anaconda

same here on python 3.8 macOS

you have to change the sourcecode to import websockets.legacy.handshake

this is happening on fedora 33 as well with Python 3.9.9
I just wanted to try this cool app with my quickstart websocket 🗡️

File "/usr/local/lib/python3.6/dist-packages/wsstat/clients.py", line 14, in
import websockets.legacy.handshake

there are many things to update beyond that