I can't understand the difference of these two BytesIO objects. If i do this :
f = open('decoder/logs/testfile.txt', 'rb')
file = io.BytesIO(f.read())
decode(file,0)
then in decode method this works :
for line in islice(file, lines, None):
But if i create BytesIO like this :
file = io.BytesIO()
file.write(b"Some codded message")
decode(file, 0)
Then loop in decode method returns nothing. What i understand is BytesIO should act as file like object but stored in memory. So why when i try to pass only one line of file this loop return nothing like there was no lines in file?