python-websockets / websockets

Library for building WebSocket servers and clients in Python

Home Page:https://websockets.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No sync module in websockets

twf66 opened this issue · comments

Hi,

I am trying to use the threading server.

When I try to use websockets.sync.server.serve I get an error saying that the reference sync cannot be found:

From IDE:
image

From runtime:
image

I can see the sync folder exists and contains modules, but I cannot utilize them.
Any help would be appreciated.

Did you import websockets.sync.server?

I suspect that your problem is the same problem demonstrated below without involving websockets:

$ python3
Python 3.10.10 (main, Feb  8 2023, 05:34:50) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib
>>> urllib.parse.quote
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'urllib' has no attribute 'parse'
>>> import urllib.parse
>>> urllib.parse.quote
<function quote at 0x1049689d0>

@aaugustin Thank You! Your import suggestion was the answer. I did try various import statements, but just did not have it quite right.