Skip to content

Commit

Permalink
Resolves the bug around 'TypeError: a bytes-like object is required, …
Browse files Browse the repository at this point in the history
…not 'str''

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.
  • Loading branch information
Brainiarc7 authored Mar 15, 2023
1 parent d5ca6e8 commit a5b1aad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packager/tools/pssh/pssh-box.py
Original file line number Diff line number Diff line change
Expand Up @@ -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', bytes(protection_scheme, encoding='utf-8'))[0]
return wv.SerializeToString()


Expand Down

0 comments on commit a5b1aad

Please sign in to comment.