Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
13 commits merged into from Mar 6, 2017
Merged
4 changes: 3 additions & 1 deletion moviepy/video/fx/blink.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 7 additions & 0 deletions tests/test_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()