Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Better file not found logging, support/tests for VideoIcon() and VideoSeries() (#626)

Jason Villanueva565eb2432f06
diff --git a/manim/mobject/svg/code_mobject.py b/manim/mobject/svg/code_mobject.py
index 86a98e6a2..c018c1924 100644
--- a/manim/mobject/svg/code_mobject.py
+++ b/manim/mobject/svg/code_mobject.py
@@ -240,9 +240,10 @@ class Code(VGroup):
if os.path.exists(path):
self.file_path = path
return
- raise IOError(
- "File %s not found. Please specify a correct file path" % self.file_name
+ error = "From: {}, could not find {} at either of these locations: {}".format(
+ os.getcwd(), self.file_name, possible_paths
)
+ raise IOError(error)
def gen_line_numbers(self):
"""Function to generate line_numbers.
diff --git a/manim/mobject/svg/drawings.py b/manim/mobject/svg/drawings.py
index 31084394d..73fc2a48d 100644
--- a/manim/mobject/svg/drawings.py
+++ b/manim/mobject/svg/drawings.py
@@ -340,7 +340,7 @@ class VideoSeries(VGroup):
videos = [VideoIcon() for x in range(self.num_videos)]
VGroup.__init__(self, *videos, **kwargs)
self.arrange()
- self.set_width(config["frame_width"] - config["med_large_buff"])
+ self.set_width(config["frame_width"] - constants.MED_LARGE_BUFF)
self.set_color_by_gradient(*self.gradient_colors)
diff --git a/manim/mobject/svg/svg_mobject.py b/manim/mobject/svg/svg_mobject.py
index 9fe65d26d..f40e8cfa5 100644
--- a/manim/mobject/svg/svg_mobject.py
+++ b/manim/mobject/svg/svg_mobject.py
@@ -62,7 +62,10 @@ class SVGMobject(VMobject):
if os.path.exists(path):
self.file_path = path
return
- raise IOError("No file matching %s in image directory" % self.file_name)
+ error = "From: {}, could not find {} at either of these locations: {}".format(
+ os.getcwd(), self.file_name, possible_paths
+ )
+ raise IOError(error)
def generate_points(self):
doc = minidom.parse(self.file_path)
diff --git a/manim/utils/file_ops.py b/manim/utils/file_ops.py
index 856c59941..cf32e9576 100644
--- a/manim/utils/file_ops.py
+++ b/manim/utils/file_ops.py
@@ -40,7 +40,10 @@ def seek_full_path_from_defaults(file_name, default_dir, extensions):
for path in possible_paths:
if os.path.exists(path):
return path
- raise IOError("File {} not Found".format(file_name))
+ error = "From: {}, could not find {} at either of these locations: {}".format(
+ os.getcwd(), self.file_name, possible_paths
+ )
+ raise IOError(error)
def modify_atime(file_path):