Skip to content

Video editing with Python

Fix flake8

osaajani8f8d38bd54b6
diff --git a/moviepy/tools.py b/moviepy/tools.py
index 148f8aa9..69cffccc 100644
--- a/moviepy/tools.py
+++ b/moviepy/tools.py
@@ -2,7 +2,6 @@
import os
import platform
-import shlex
import subprocess as sp
import warnings
@@ -55,12 +54,11 @@ def ffmpeg_escape_filename(filename):
"""Escape a filename that we want to pass to the ffmpeg command line
That will ensure the filename doesn't start with a '-' (which would raise an error)
- and use `shlex.quote` to escape filenames with spaces and special chars.
"""
if filename.startswith('-') :
filename = '.' + os.sep + filename
- return shlex.quote(filename)
+ return filename
def convert_to_seconds(time):
diff --git a/tests/test_ffmpeg_writer.py b/tests/test_ffmpeg_writer.py
index 0985b61d..418d3718 100644
--- a/tests/test_ffmpeg_writer.py
+++ b/tests/test_ffmpeg_writer.py
@@ -231,3 +231,9 @@ def test_write_gif(util, clip_class, loop, with_mask):
assert r == 0
assert g == 0
assert b == 255
+
+
+def test_write_file_with_spaces(util):
+ filename = os.path.join(util.TMP_DIR, "name with spaces.mp4")
+ clip = ColorClip((1, 1), color=1, is_mask=True).with_fps(1).with_duration(0.3)
+ ffmpeg_write_video(clip, filename, fps=1)
diff --git a/tests/test_tools.py b/tests/test_tools.py
index e15ebe5a..97984d3a 100644
--- a/tests/test_tools.py
+++ b/tests/test_tools.py
@@ -72,7 +72,7 @@ def test_subprocess_call(command):
("-path/that/starts/with/dash.mp4", "./-path/that/starts/with/dash.mp4"),
("file-name-.mp4", "file-name-.mp4"),
("/absolute/path/to/-file.mp4", "/absolute/path/to/-file.mp4"),
- ("filename with spaces.mp4", "'filename with spaces.mp4'")
+ ("filename with spaces.mp4", "filename with spaces.mp4")
],
)
def test_ffmpeg_escape_filename(given, expected):