You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running python3 -m websockets wss://echo.websocket.org/ on Python 3.8.5 gives an uninformative error:
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/$USER/websockets/src/websockets/__main__.py", line 215, in <module>
main()
File "/home/$USER/websockets/src/websockets/__main__.py", line 181, in main
async def queue_factory() -> asyncio.Queue[str]:
TypeError: 'type' object is not subscriptable
This does not fit the Python version requirement specified in the documentation.
The fix could be either:
quoting the asyncio.Queue[str] on the line 181 of __main__.py, or
importing from __future__ import annotations the backwards compatility.
NOTE: If the latter fix is chosen, I think it would be style-consistent to convert other quoted type hints (on lines 94 and 95) to type-hinted generics.
Running
python3 -m websockets wss://echo.websocket.org/
on Python 3.8.5 gives an uninformative error:The issue is related to the PEP 585 - Type Hinting Generics In Standard Collections, which is introduced in Python 3.9.
This does not fit the Python version requirement specified in the documentation.
The fix could be either:
asyncio.Queue[str]
on the line 181 of__main__.py
, orfrom __future__ import annotations
the backwards compatility.NOTE: If the latter fix is chosen, I think it would be style-consistent to convert other quoted type hints (on lines 94 and 95) to type-hinted generics.
I have submitted a PR with the latter fix.
The text was updated successfully, but these errors were encountered: