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

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte #469

Open
imhui opened this issue Apr 20, 2024 · 1 comment
Labels
question Further information is requested

Comments

@imhui
Copy link

imhui commented Apr 20, 2024

call method messages.stream, got a exception:

Traceback:

File "/path/to/project/.venv/lib/python3.11/site-packages/anthropic/lib/streaming/_messages.py", line 342, in stream_text
async for chunk in self:
File "/path/to/project/.venv/lib/python3.11/site-packages/anthropic/_streaming.py", line 141, in aiter
async for item in self._iterator:
File "/path/to/project/.venv/lib/python3.11/site-packages/anthropic/lib/streaming/_messages.py", line 321, in stream
async for event in super().stream():
File "/path/to/project/.venv/lib/python3.11/site-packages/anthropic/_streaming.py", line 154, in stream
async for sse in iterator:
File "/path/to/project/.venv/lib/python3.11/site-packages/anthropic/_streaming.py", line 145, in _iter_events
async for sse in self._decoder.aiter_bytes(self.response.aiter_bytes()):
File "/path/to/project/.venv/lib/python3.11/site-packages/anthropic/_streaming.py", line 294, in aiter_bytes
line = raw_line.decode("utf-8")
^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

@rattrayalex
Copy link
Collaborator

rattrayalex commented Apr 22, 2024

Thanks for reporting. What version of the library is this happening with? (Please check that it's still happening on the latest version).

Can you share a repro script?

@olu-an olu-an added the question Further information is requested label May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants