Value Error: 'embedded null character' when attempting to write decompressed data to a file

时间:2019-01-18 18:47:49

标签: python compression zlib

The decompression is successful, however when I attempt to write it to the disk I get a ValueError as follows:

error: embedded null character.

I'm using python3, with zlib.

data.seek(offset, 0)
x = zlib.decompress(data.read(compSize))
with open(fName,"wb+") as d:
    d.write(x)

How can I write the raw binary data?

I mean it is really simple to do in C. I don't exactly understand why does python try to interpret the bytes in it.

0 个答案:

没有答案