From 0696610dee64f47a63d544fc06510efe2bcfbe59 Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 13 Mar 2021 00:14:07 +0100 Subject: [PATCH] give up, just try both and see what sticks --- copyparty/util.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/copyparty/util.py b/copyparty/util.py index 15008e30..9df8d130 100644 --- a/copyparty/util.py +++ b/copyparty/util.py @@ -837,7 +837,11 @@ def chkcmd(*argv): def gzip_orig_sz(fn): with open(fsenc(fn), "rb") as f: f.seek(-4, 2) - return struct.unpack(b"I", f.read(4))[0] + rv = f.read(4) + try: + return struct.unpack(b"I", rv)[0] + except: + return struct.unpack("I", rv)[0] def py_desc(): @@ -847,7 +851,11 @@ def py_desc(): if ofs > 0: py_ver = py_ver[:ofs] - bitness = struct.calcsize(b"P") * 8 + try: + bitness = struct.calcsize(b"P") * 8 + except: + bitness = struct.calcsize("P") * 8 + host_os = platform.system() compiler = platform.python_compiler()