Skip to content

Video editing with Python

More removals of Py2/3 check code.

Tom Burrows64badbc86ea3
diff --git a/README.rst b/README.rst
index 2edc1e31..f26432eb 100644
--- a/README.rst
+++ b/README.rst
@@ -16,7 +16,7 @@ MoviePy
MoviePy (full documentation_) is a Python library for video editing: cutting, concatenations, title insertions, video compositing (a.k.a. non-linear editing), video processing, and creation of custom effects. See the gallery_ for some examples of use.
-MoviePy can read and write all the most common audio and video formats, including GIF, and runs on Windows/Mac/Linux, with Python 2.7+ and 3 (or only Python 3.4+ from v.1.0). Here it is in action in an IPython notebook:
+MoviePy can read and write all the most common audio and video formats, including GIF, and runs on Windows/Mac/Linux, with Python 3.5+. Here it is in action in an IPython notebook:
.. image:: https://raw.githubusercontent.com/Zulko/moviepy/master/docs/demo_preview.jpeg
:alt: [logo]
diff --git a/moviepy/decorators.py b/moviepy/decorators.py
index 277276ca..189634d7 100644
--- a/moviepy/decorators.py
+++ b/moviepy/decorators.py
@@ -76,10 +76,7 @@ def preprocess_args(fun,varnames):
""" Applies fun to variables in varnames before launching the function """
def wrapper(f, *a, **kw):
- if hasattr(f, "func_code"):
- func_code = f.func_code # Python 2
- else:
- func_code = f.__code__ # Python 3
+ func_code = f.__code__
names = func_code.co_varnames
new_a = [fun(arg) if (name in varnames) else arg
@@ -120,10 +117,7 @@ def use_clip_fps_by_default(f, clip, *a, **k):
" the clip's fps with `clip.fps=24`" % f.__name__)
- if hasattr(f, "func_code"):
- func_code = f.func_code # Python 2
- else:
- func_code = f.__code__ # Python 3
+ func_code = f.__code__
names = func_code.co_varnames[1:]
diff --git a/moviepy/video/compositing/concatenate.py b/moviepy/video/compositing/concatenate.py
index 53526087..a59e974b 100644
--- a/moviepy/video/compositing/concatenate.py
+++ b/moviepy/video/compositing/concatenate.py
@@ -1,4 +1,5 @@
import numpy as np
+from functools import reduce
from moviepy.audio.AudioClip import CompositeAudioClip
from moviepy.tools import deprecated_version_of
@@ -6,11 +7,6 @@ from moviepy.video.compositing.CompositeVideoClip import CompositeVideoClip
from moviepy.video.compositing.on_color import on_color
from moviepy.video.VideoClip import ColorClip, VideoClip
-try: # Python 2
- reduce
-except NameError: # Python 3
- from functools import reduce
-
def concatenate_videoclips(clips, method="chain", transition=None,
bg_color=None, ismask=False, padding = 0):