From eba755e903ab6fa41a1b8dd68cc53b44a1e39aa2 Mon Sep 17 00:00:00 2001 From: Stephan Steinbach <61017+ssteinbach@users.noreply.github.com> Date: Thu, 18 Aug 2022 10:11:18 -0700 Subject: [PATCH] Python3 fixes for the shot_detect example (#1374) Signed-off-by: ssteinbach Signed-off-by: Michele Spina --- examples/shot_detect.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/shot_detect.py b/examples/shot_detect.py index 2fdfad839b..c706439d82 100755 --- a/examples/shot_detect.py +++ b/examples/shot_detect.py @@ -216,7 +216,15 @@ def _ffprobe_fps(name, full_path, dryrun=False): if dryrun: return 1.0 - for line in err.split('\n'): + try: + # python3 + # if its bytes (python3+) + err_str = err.decode("utf-8") + except AttributeError: + # if its a string (python <3) + err_str = err + + for line in err_str.split('\n'): if not ("Stream" in line and "Video" in line): continue