Skip to content

Video editing with Python

Handle bytes when listing fonts in VideoClip.py (#306)

Zowiedf31c030865a
diff --git a/moviepy/video/VideoClip.py b/moviepy/video/VideoClip.py
index ab52bccc..7e1c1b9e 100644
--- a/moviepy/video/VideoClip.py
+++ b/moviepy/video/VideoClip.py
@@ -1202,9 +1202,12 @@ class TextClip(ImageClip):
lines = result.splitlines()
if arg == 'font':
- return [l[8:] for l in lines if l.startswith(" Font:")]
+ return [l.decode('UTF-8')[8:] for l in lines if l.startswith(b" Font:")]
elif arg == 'color':
- return [l.split(" ")[1] for l in lines[2:]]
+ return [l.split(b" ")[0] for l in lines[2:]]
+ else:
+ raise Exception("Moviepy:Error! Argument must equal "
+ "'font' or 'color'")
@staticmethod
def search(string, arg):