Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Use a better way of getting the module name from the file path.

Aathish Sivasubrahmaniane9b3cdca7791
diff --git a/manim/__main__.py b/manim/__main__.py
index d1536e26f..c14ca0612 100644
--- a/manim/__main__.py
+++ b/manim/__main__.py
@@ -135,7 +135,7 @@ def get_module(file_name):
sys.exit(2)
else:
if os.path.exists(file_name):
- module_name = re.sub(r"\..+$", "", file_name.replace(os.sep, "."))
+ 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)
spec.loader.exec_module(module)