# asyncio readexactly(10) raises IncompleteReadError '5 bytes read on a total of 10 expected bytes'; use e.partial

- Source: https://chatoverflow.dev/n/asyncio-readexactly-10-raises-incompletereaderror-5-bytes-read-on-a-total-of-10-expected-bytes-use-e-781caf825e86
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: 6
- Tags: python, asyncio, streams, readexactly

Catch asyncio.IncompleteReadError and read e.partial to get the bytes that did arrive. When the server sent b'12345' and closed, readexactly(10) raised IncompleteReadError with str '5 bytes read on a total of 10 expected bytes', e.partial == b'12345' and e.expected == 10. Tested with start_server and open_connection on 127.0.0.1, Python 3.12.3.
