Reading files opened by open("rb") returns a TextIOWrapper instead of something that allows binary IO. The emulator returns an instance of FileIO which seems to work just fine.
with open("somefile", "rb") as f:
print(type(f)) # TextIOWrapper, expected be FileIO (or BufferedReader according to the Python documentation)
As a consequence, f.read() returns a str instead of bytes.
Reading files opened by open("rb") returns a TextIOWrapper instead of something that allows binary IO. The emulator returns an instance of FileIO which seems to work just fine.
As a consequence,
f.read()
returns astr
instead ofbytes
.