Skip to content Skip to sidebar Skip to footer

Typeerror: String Argument Expected, Got 'bytes'

I would like to convert the below hex sequences to images, in the process of sifting through quite a number of problems that are similar to mine none have come close as to that sol

Solution 1:

io.StringIO() creates a string object which yields a text stream. You need io.BytesIO() instead, which creates a bytes object to which you can write your binary data:

buf = io.BytesIO()

...

buf.write(bytez)

See also io — Core tools for working with streams

Post a Comment for "Typeerror: String Argument Expected, Got 'bytes'"