Skip to content

Video editing with Python

add test for issue 417

Billy Earney3d877cb4b1e7
diff --git a/moviepy/video/VideoClip.py b/moviepy/video/VideoClip.py
index 4cbab379..e52b593e 100644
--- a/moviepy/video/VideoClip.py
+++ b/moviepy/video/VideoClip.py
@@ -40,6 +40,7 @@ from ..decorators import (apply_to_mask,
convert_masks_to_RGB,
use_clip_fps_by_default)
+from ..compat import PY3
try:
from subprocess import DEVNULL # py3k
except ImportError:
@@ -919,8 +920,12 @@ class ImageClip(VideoClip):
VideoClip.__init__(self, ismask=ismask, duration=duration)
- if isinstance(img, (str, unicode)):
- img = imread(img)
+ if PY3:
+ if isinstance(img, str):
+ img = imread(img)
+ else:
+ if isinstance(img, (str, unicode)):
+ img = imread(img)
if len(img.shape) == 3: # img is (now) a RGB(a) numpy array
diff --git a/tests/test_issues.py b/tests/test_issues.py
index e889d711..7886e221 100644
--- a/tests/test_issues.py
+++ b/tests/test_issues.py
@@ -43,3 +43,5 @@ def test_issue_417():
final = CompositeVideoClip([myclip], size=(1280, 720))
#final.set_duration(7).write_videofile("test.mp4", fps=30)
+if __name__ == '__main__':
+ pytest.main()