Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Raise an exception if file is not a python script.

Aathish Sivasubrahmanian75ebd56029a1
diff --git a/manim/__main__.py b/manim/__main__.py
index c14ca0612..df5e9dd30 100644
--- a/manim/__main__.py
+++ b/manim/__main__.py
@@ -135,6 +135,8 @@ def get_module(file_name):
sys.exit(2)
else:
if os.path.exists(file_name):
+ if file_name[-3:] != ".py":
+ raise Exception(f"{file_name} is not a valid Manim python script.")
module_name = file_name[:-3].replace(os.sep, '.').split('.')[-1]
spec = importlib.util.spec_from_file_location(module_name, file_name)
module = importlib.util.module_from_spec(spec)