python-websockets / websockets

Library for building WebSocket servers and clients in Python
https://websockets.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
5.23k stars 519 forks source link

Add missing import #1539

Closed simontorres closed 1 week ago

simontorres commented 1 week ago

When handling the ConnectionClosedOK exception the tutorial didn't mention the need to import websockets or just the exception

aaugustin commented 1 week ago

Good catch - regression from 14ca557f53cf19084eb64aef2e4563e5630c211b that changed import websockets; websockets.serve to from websockets.asyncio.server import serve; serve

aaugustin commented 1 week ago

I fixed it a bit differently, by using the real import path rather than the shortcut.

Also I fixed a few other instances of this problem at the same time.

aaugustin commented 1 week ago

Thank you for reporting this problem!