From 9c111ca792fb878e2e89a96c1bc858fdc226d203 Mon Sep 17 00:00:00 2001 From: AetherBreeze <26798666+AetherBreeze@users.noreply.github.com> Date: Sun, 23 Aug 2020 10:56:15 -0400 Subject: [PATCH] Fixed bug that broke some Windows CLIs In some Windows CLIs, the command `manim file.py ...` will generate the argv `C:\\path\\to\\manim.exe file.py ...` This would cause _from_command_line() to misleadingly return False, which completely prevents users from calling manim from the CLI, as certain key fields like `input_file` would not be populated. --- manim/utils/config_utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/manim/utils/config_utils.py b/manim/utils/config_utils.py index e3ffef8d6e..7a1e1d562a 100644 --- a/manim/utils/config_utils.py +++ b/manim/utils/config_utils.py @@ -435,9 +435,11 @@ def _init_dirs(config): def _from_command_line(): """Determine if manim was called from the command line.""" # Manim can be called from the command line in three different - # ways. The first two involve using the manim or manimcm commands + # ways. The first two involve using the manim or manimcm commands. + # Note that some Windows CLIs replace those commands with the path + # to their executables, so we must check for this as well prog = os.path.split(sys.argv[0])[-1] - from_cli_command = prog in ["manim", "manimcm"] + from_cli_command = prog in ["manim", "manim.exe", "manimcm", "manimcm.exe"] # The third way involves using `python -m manim ...`. In this # case, the CLI arguments passed to manim do not include 'manim',