|
|
||
| with open('foobar.docx', 'rb') as f: | ||
| source_stream = StringIO(f.read()) | ||
| source_stream = BytesIO(f.read()) |
There was a problem hiding this comment.
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.
Sorry, something went wrong.
|
Alright noted |
Sorry, something went wrong.
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.