Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Automatically import manim if not imported.

Aathish Sivasubrahmanianb28b9a2cc822
diff --git a/manim/__main__.py b/manim/__main__.py
index 0bd7225e5..2e062f822 100644
--- a/manim/__main__.py
+++ b/manim/__main__.py
@@ -124,8 +124,11 @@ def get_scene_classes_from_module(module):
def get_module(file_name):
if file_name == "-":
module = types.ModuleType("input_scenes")
- logger.info("Enter the code for your animation and end with an EOF (usually CTRL+D):")
+ logger.info("Enter the animation's code & end with an EOF (CTRL+D or CTRL+Z on Windows):")
code = sys.stdin.read()
+ if not code.startswith("from manim import"):
+ logger.warn("Didn't find an import statement for Manim. Importing automatically...")
+ code="from manim import *\n"+code
logger.info("Rendering animation from typed code...")
try:
exec(code, module.__dict__)