From fe4be5abee360a836c88f77163689cfa9bbcde3f Mon Sep 17 00:00:00 2001 From: Ibrahim Abayomi Ogunbiyi <73393430+ibrahim-ogunbiyi@users.noreply.github.com> Date: Thu, 21 Aug 2025 12:20:27 +0100 Subject: [PATCH] Update documents.rst I think it's best to replace `StringIO` with `BytesIO` since we are working with bytes. This ensures that beginners, or anyone skimming the documentation and copying code, end up with correct and functional code. --- docs/user/documents.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/user/documents.rst b/docs/user/documents.rst index ecdfefab1..633fe3264 100644 --- a/docs/user/documents.rst +++ b/docs/user/documents.rst @@ -78,11 +78,11 @@ a document like so:: # or with open('foobar.docx', 'rb') as f: - source_stream = StringIO(f.read()) + source_stream = BytesIO(f.read()) document = Document(source_stream) source_stream.close() ... - target_stream = StringIO() + target_stream = BytesIO() document.save(target_stream) The ``'rb'`` file open mode parameter isn't required on all operating