Skip to content

Video editing with Python

Issue 467; fix Nameerror with copy function. Added issue to tests.. (#468)

Billy Earneyb3058a6fae74
diff --git a/moviepy/video/fx/blink.py b/moviepy/video/fx/blink.py
index 7fce9744..93e022b1 100644
--- a/moviepy/video/fx/blink.py
+++ b/moviepy/video/fx/blink.py
@@ -1,10 +1,12 @@
+import copy
+
def blink(clip, d_on, d_off):
"""
Makes the clip blink. At each blink it will be displayed ``d_on``
seconds and disappear ``d_off`` seconds. Will only work in
composite clips.
"""
- newclip = copy(clip)
+ newclip = copy.copy(clip)
if newclip.mask is None:
newclip = newclip.with_mask()
D = d_on + d_off
diff --git a/tests/test_issues.py b/tests/test_issues.py
index bb76efe6..01e7bdc3 100644
--- a/tests/test_issues.py
+++ b/tests/test_issues.py
@@ -59,5 +59,12 @@ def test_issue_417():
final = CompositeVideoClip([myclip], size=(1280, 720))
#final.set_duration(7).write_videofile("test.mp4", fps=30)
+def test_issue_467():
+ cad = 'media/python_logo.png'
+ clip = ImageClip(cad)
+
+ #caused an error, NameError: global name 'copy' is not defined
+ clip = clip.fx(vfx.blink, d_on=1, d_off=1)
+
if __name__ == '__main__':
pytest.main()