Skip to content

Video editing with Python

Define string_types in compat.py

cclaussf8241d8bdaa1
diff --git a/moviepy/compat.py b/moviepy/compat.py
index ceac4d31..7a007e56 100644
--- a/moviepy/compat.py
+++ b/moviepy/compat.py
@@ -2,7 +2,12 @@ import os
import sys
PY3=sys.version_info.major >= 3
-if PY3:
- from subprocess import DEVNULL # py3k
-else:
- DEVNULL = open(os.devnull, 'wb')
+try:
+ string_types = (str, unicode)
+except NameError:
+ string_types = (str)
+
+try:
+ from subprocess import DEVNULL # Python 3
+except ImportError:
+ DEVNULL = open(os.devnull, 'wb') # Python 2