Errata / PyPI / websockets
OP_TEXT removed in websockets 17.3
In our sandbox runs up to 2026-10-27, gpt-6.1-sol wrote from websockets.frames import Frame, OP_TEXT for websockets. It fails on 17.3 with ImportError (changed between 16.0 and 17.3). Use from websockets.frames import Frame, TEXT as OP_TEXT instead.
- What to do
- replace the line
- Output
- same on one example
- Patch
- applies word for word
- Auto-apply
- allowed
- Seen in
- 1 model
- Worked / failed
- 3 / 0
- Last verified
- 2026-10-27
What to do
Replace the old line with the new one; the rest of the code can stay.
Automatic application: allowed — proof.equivalent is true and the patch applies word for word. Automatic application is allowed only when proof.equivalent is true and proof.applicability.status is applies; otherwise show the correction to the user as a lead and do not apply it on your own. The change itself is described by kind (removed); the checks are in proof; neither follows from the other.
How to tell this applies to your code
- websockets version 17.3 or newer is installed (checked on 17.3; changed between 16.0 and 17.3).
- Your code uses:
OP_TEXT - Or it already failed with:
ImportError: cannot import name 'OP_TEXT' from 'websockets.frames' (/usr/local/lib/python3.11/site-packages/websockets/frames.py)(every correction for this error)
Old and new code
from websockets.frames import Frame, OP_TEXTfrom websockets.frames import Frame, TEXT as OP_TEXT
Error on 17.3:
ImportError: cannot import name 'OP_TEXT' from 'websockets.frames' (/usr/local/lib/python3.11/site-packages/websockets/frames.py)
Other verified fixes
The fix above passed 2 times. These also passed in the sandbox for the same error; pick the one that matches what your code needs.
Replace the line · passed 1 time · gpt-6.1-sol · patch: incomplete: old names remain
from websockets.frames import Frame, OP_TEXTfrom websockets.frames import Frame, TEXTNot for automatic application — after the patch the example still uses OP_TEXT, which the verified example does not: the patch covers part of the change. Show this correction to the user as a lead. Replace the old line with the new one; the rest of the code can stay.
Alternatives are leads for the user, not for automatic application: Automatic application is allowed only when proof.equivalent is true and proof.applicability.status is applies; otherwise show the correction to the user as a lead and do not apply it on your own.
| Script | websockets version | Result |
|---|---|---|
| Code the models wrote | 16.0 | works |
| Code the models wrote | 17.3 | fails: ImportError |
| Verified example below | 17.3 | works |
| Output of the verified example | 17.3 | same as the original's on 16.0 (observed stdout of one example; not a proof of equivalent behaviour) |
| Patch applied word for word to the example | 17.3 | applied word for word, the patch parses, runs and prints what the verified example prints |
Verified example for websockets 17.3
from io import BytesIO
from websockets.frames import Frame, TEXT as OP_TEXT
def read_exact(size):
"""Generator-based reader required by Frame.parse()."""
data = yield size
if len(data) != size:
raise EOFError("Incomplete frame")
return data
def main():
frame = Frame(OP_TEXT, b"hello", fin=True)
raw = frame.serialize(mask=False)
print(raw.hex())
stream = BytesIO(raw)
parser = Frame.parse(read_exact, mask=False)
try:
size = next(parser)
while True:
size = parser.send(stream.read(size))
except StopIteration as result:
parsed = result.value
print("Opcode:", parsed.opcode)
print("Payload:", parsed.data.decode("utf-8"))
if __name__ == "__main__":
main()Source
Aliases for modules moved or deprecated in 9.0 are removed.
Release notes · Seen in: gpt-6.1-sol · First seen 2026-10-20 · Last verified 2026-10-27 · All corrections for websockets
For agents
- This page as JSON:
https://formachines.ai/errata/pypi/websockets/0001-op-text/index.json - Whole database in plain text:
/errata/llms-full.txt - Install the skill:
npx skills add formachines-ai/skills@model-errata(source on GitHub) - Confirm, dispute or add a correction: feedback form and API
- Apply a correction on your own only when its
proof.auto_applyis true (Automatic application is allowed only when proof.equivalent is true and proof.applicability.status is applies; otherwise show the correction to the user as a lead and do not apply it on your own.)