From 56ed3538f6048e46ee51356a7c1f602138a7a7af Mon Sep 17 00:00:00 2001 From: pdcxs Date: Sun, 13 Jan 2019 23:29:46 +0800 Subject: [PATCH] Fix the file problem when combine videos on Windows --- manimlib/scene/scene.py | 7 ++++++- manimlib/utils/output_directory_getters.py | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/manimlib/scene/scene.py b/manimlib/scene/scene.py index b4331f79..b3cceb68 100644 --- a/manimlib/scene/scene.py +++ b/manimlib/scene/scene.py @@ -733,8 +733,13 @@ class Scene(Container): '-loglevel', 'error', movie_file_path ] - subprocess.call(commands) + combine_process = subprocess.Popen(commands) + combine_process.wait() + for pf_path in partial_movie_files: + os.remove(pf_path) os.remove(file_list) + os.rmdir(partial_movie_file_directory) + os.rmdir(os.path.join(partial_movie_file_directory, os.path.pardir)) print("File ready at {}".format(movie_file_path)) def tex(self, latex): diff --git a/manimlib/utils/output_directory_getters.py b/manimlib/utils/output_directory_getters.py index 3e364271..a3695249 100644 --- a/manimlib/utils/output_directory_getters.py +++ b/manimlib/utils/output_directory_getters.py @@ -15,7 +15,7 @@ def add_extension_if_not_present(file_name, extension): def guarantee_existance(path): if not os.path.exists(path): os.makedirs(path) - return path + return os.path.abspath(path) def get_scene_output_directory(scene_class): @@ -78,4 +78,4 @@ def get_sorted_integer_files(directory, elif remove_non_integer_files: os.remove(full_path) indexed_files.sort(key=lambda p: p[0]) - return list(map(lambda p: p[1], indexed_files)) + return list(map(lambda p: os.path.join(directory, p[1]), indexed_files))