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

fix: Internal Sanic websocket import error #12

Merged
merged 1 commit into from
May 9, 2023

Conversation

Yimura
Copy link
Contributor

@Yimura Yimura commented May 9, 2023

This PR fixes an issue with Sanic crashing when importing from websockets.connection.
This is a temporary fix until Sanic fixes their constraints.

Steps I did to reproduce

  1. Clone repo
  2. Try to deploy using docker
  3. Observe crash in application output

Stack Trace

ImportError: cannot import name 'CLOSED' from 'websockets.connection' (/usr/local/lib/python3.9/site-packages/websockets/connection.py)
Traceback (most recent call last):
  File "/usr/local/bin/sanic", line 5, in <module>
    from sanic.__main__ import main
  File "/usr/local/lib/python3.9/site-packages/sanic/__init__.py", line 2, in <module>
    from sanic.app import Sanic
  File "/usr/local/lib/python3.9/site-packages/sanic/app.py", line 102, in <module>
    from sanic.server.protocols.websocket_protocol import WebSocketProtocol
  File "/usr/local/lib/python3.9/site-packages/sanic/server/protocols/websocket_protocol.py", line 3, in <module>
    from websockets.connection import CLOSED, CLOSING, OPEN
samfetch-samfetch-1  | ImportError: cannot import name 'CLOSED' from 'websockets.connection' (/usr/local/lib/python3.9/site-packages/websockets/connection.py)

Related

sanic-org/sanic#2733

@ysfchn ysfchn merged commit bff17f2 into ysfchn:main May 9, 2023
@ysfchn
Copy link
Owner

ysfchn commented May 9, 2023

Thanks! 😄

@Yimura Yimura deleted the fix-websocket-import-error branch May 19, 2023 11:52
@3152460b
Copy link

The following is connected by a chain

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

Successfully merging this pull request may close these issues.

None yet

3 participants