Browse Source

More Python 2 compatibility fixes

test_fixup
Vadim Lebedev 2 years ago
parent
commit
2f7a7d674f
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      libarchive/__init__.py

+ 4
- 1
libarchive/__init__.py View File

@@ -285,7 +285,10 @@ class EntryWriteStream(object):
if self.closed:
raise Exception('Cannot write to closed stream.')
if self.buffer:
self.buffer.write(data)
if PY3:
self.buffer.write(data)
else:
self.buffer.write(data.encode('utf-8'))
else:
_libarchive.archive_write_data_from_str(self.archive._a, data.encode('utf-8'))
self.bytes += len(data)


Loading…
Cancel
Save