Feb-26-2024, 03:10 PM
(This post was last modified: Feb-26-2024, 03:10 PM by Gribouillis.)
You could replace line 25 with
data = rawdata.decode(encoding=encoding)Then at line 27, open the file in binary mode, without encoding because data is normally a byte string after the encode() of line 26.
« We can solve any problem by introducing an extra level of indirection »