Skip to content

Commit 06602b7

Browse files
authored
Fixed bug that broke some Windows CLIs (#336)
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.
1 parent 6852493 commit 06602b7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

manim/utils/config_utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,9 +435,11 @@ def _init_dirs(config):
435435
def _from_command_line():
436436
"""Determine if manim was called from the command line."""
437437
# Manim can be called from the command line in three different
438-
# ways. The first two involve using the manim or manimcm commands
438+
# ways. The first two involve using the manim or manimcm commands.
439+
# Note that some Windows CLIs replace those commands with the path
440+
# to their executables, so we must check for this as well
439441
prog = os.path.split(sys.argv[0])[-1]
440-
from_cli_command = prog in ["manim", "manimcm"]
442+
from_cli_command = prog in ["manim", "manim.exe", "manimcm", "manimcm.exe"]
441443

442444
# The third way involves using `python -m manim ...`. In this
443445
# case, the CLI arguments passed to manim do not include 'manim',

0 commit comments

Comments
 (0)