Skip to content

Custom config file also when not run from CLI #219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions manim/utils/config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,24 +373,24 @@ def _run_config():
config_files = _paths_config_file()
if _from_command_line():
args = _parse_cli(sys.argv[1:])
if args.config_file is not None:
if os.path.exists(args.config_file):
config_files.append(args.config_file)
else:
raise FileNotFoundError(f"Config file {args.config_file} doesn't exist")
else:
script_directory_file_config = os.path.join(
os.path.dirname(args.file), "manim.cfg"
)
if os.path.exists(script_directory_file_config):
config_files.append(script_directory_file_config)

else:
# In this case, we still need an empty args object.
args = _parse_cli([], input=False)
# Need to populate the options left out
args.file, args.scene_names, args.output_file = "", "", ""

if args.config_file is not None:
if os.path.exists(args.config_file):
config_files.append(args.config_file)
else:
raise FileNotFoundError(f"Config file {args.config_file} doesn't exist")
else:
script_directory_file_config = os.path.join(
os.path.dirname(args.file), "manim.cfg"
)
if os.path.exists(script_directory_file_config):
config_files.append(script_directory_file_config)

config_parser = configparser.ConfigParser()
successfully_read_files = config_parser.read(config_files)

Expand Down