Fix fetch_data on python 3

This commit is contained in:
mvdbeek
2019-06-16 17:25:51 +02:00
parent cf9a603ae5
commit 0fe107ecc6
+2
View File
@@ -76,6 +76,8 @@ def stream_to_open_named_file(stream, fd, filename, source_encoding=None, source
else:
# Compressed files must be encoded after they are uncompressed in the upload utility,
# while binary files should not be encoded at all.
if isinstance(chunk, text_type):
chunk = chunk.encode(target_encoding, target_error)
os.write(fd, chunk)
os.close(fd)
return filename