Skip to content

Conversation

ibrahim-ogunbiyi
Copy link

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.

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.
@@ -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())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, interesting. I'm sure this is an artifact of this documentation being written during the Python 2 era, when StringIO actually meant "read bytes".

I'll put it on the shortlist and fix it up next time I'm in there.

@ibrahim-ogunbiyi
Copy link
Author

Alright noted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants