From 161947f53e76b0b0bb184636d95c036274494cc7 Mon Sep 17 00:00:00 2001 From: "Dennis E. Mungai" <2356871+Brainiarc7@users.noreply.github.com> Date: Mon, 1 May 2023 19:06:56 +0300 Subject: [PATCH] fix: Fix type error in pssh-box.py with Python 3.10+ (#1187) A single-line change on #L170 to `wv.protection_scheme = struct.unpack('>L', bytes(protection_scheme, encoding='utf-8'))[0]`, needed to work around this issue on Ubuntu 22.04LTS+ running Python 3.10+: ```sh TypeError: a bytes-like object is required, not 'str' ``` On line 170. --- packager/tools/pssh/pssh-box.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packager/tools/pssh/pssh-box.py b/packager/tools/pssh/pssh-box.py index 9216be28a1..7c2b20ffa0 100755 --- a/packager/tools/pssh/pssh-box.py +++ b/packager/tools/pssh/pssh-box.py @@ -167,7 +167,7 @@ def _generate_widevine_data(key_ids, content_id, provider, protection_scheme): wv.content_id = content_id # 'cenc' is the default, so omitted to save bytes. if protection_scheme and protection_scheme != 'cenc': - wv.protection_scheme = struct.unpack('>L', protection_scheme)[0] + wv.protection_scheme = struct.unpack('>L', protection_scheme.encode())[0] return wv.SerializeToString()