diff --git a/patoolib/programs/py_bz2.py b/patoolib/programs/py_bz2.py index 2be3669..71be192 100644 --- a/patoolib/programs/py_bz2.py +++ b/patoolib/programs/py_bz2.py @@ -54,7 +54,7 @@ def create_bzip2 (archive, compression, cmd, *args, **kwargs): bz2file = bz2.BZ2File(archive, 'wb') try: filename = args[0] - with open(filename) as srcfile: + with open(filename, 'rb') as srcfile: data = srcfile.read(READ_SIZE_BYTES) while data: bz2file.write(data) diff --git a/patoolib/programs/py_gzip.py b/patoolib/programs/py_gzip.py index 12c040e..7e7a4c4 100644 --- a/patoolib/programs/py_gzip.py +++ b/patoolib/programs/py_gzip.py @@ -52,7 +52,7 @@ def create_gzip (archive, compression, cmd, *args, **kwargs): gzipfile = gzip.GzipFile(archive, 'wb') try: filename = args[0] - with open(filename) as srcfile: + with open(filename, 'rb') as srcfile: data = srcfile.read(READ_SIZE_BYTES) while data: gzipfile.write(data) diff --git a/patoolib/programs/py_lzma.py b/patoolib/programs/py_lzma.py index d02a146..c80e1c3 100644 --- a/patoolib/programs/py_lzma.py +++ b/patoolib/programs/py_lzma.py @@ -58,7 +58,7 @@ def _create(archive, compression, cmd, format, *args, **kwargs): lzmafile = lzma.LZMAFile(archive, 'wb', format) try: filename = args[0] - with open(filename) as srcfile: + with open(filename, 'rb') as srcfile: data = srcfile.read(READ_SIZE_BYTES) while data: lzmafile.write(data)