Skip to content

Commit d9c0734

Browse files
authored
Merge pull request #219 from azarzadavila/config-no-cli
Custom config file also when not run from CLI
2 parents ecc208a + 1dbbb3e commit d9c0734

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

manim/utils/config_utils.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -373,24 +373,24 @@ def _run_config():
373373
config_files = _paths_config_file()
374374
if _from_command_line():
375375
args = _parse_cli(sys.argv[1:])
376-
if args.config_file is not None:
377-
if os.path.exists(args.config_file):
378-
config_files.append(args.config_file)
379-
else:
380-
raise FileNotFoundError(f"Config file {args.config_file} doesn't exist")
381-
else:
382-
script_directory_file_config = os.path.join(
383-
os.path.dirname(args.file), "manim.cfg"
384-
)
385-
if os.path.exists(script_directory_file_config):
386-
config_files.append(script_directory_file_config)
387-
388376
else:
389377
# In this case, we still need an empty args object.
390378
args = _parse_cli([], input=False)
391379
# Need to populate the options left out
392380
args.file, args.scene_names, args.output_file = "", "", ""
393381

382+
if args.config_file is not None:
383+
if os.path.exists(args.config_file):
384+
config_files.append(args.config_file)
385+
else:
386+
raise FileNotFoundError(f"Config file {args.config_file} doesn't exist")
387+
else:
388+
script_directory_file_config = os.path.join(
389+
os.path.dirname(args.file), "manim.cfg"
390+
)
391+
if os.path.exists(script_directory_file_config):
392+
config_files.append(script_directory_file_config)
393+
394394
config_parser = configparser.ConfigParser()
395395
successfully_read_files = config_parser.read(config_files)
396396

0 commit comments

Comments
 (0)