Skip to content

Impossible to use a custom manim.cfg when NOT running from CLI #184

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

Closed
huguesdevimeux opened this issue Jul 8, 2020 · 1 comment · Fixed by #219
Closed

Impossible to use a custom manim.cfg when NOT running from CLI #184

huguesdevimeux opened this issue Jul 8, 2020 · 1 comment · Fixed by #219
Labels
pr:bugfix Bug fix for use in PRs solving a specific issue:bug

Comments

@huguesdevimeux
Copy link
Member

huguesdevimeux commented Jul 8, 2020

Basically the title. When rendering the scene from python itself (that's what is done in the actual tests), it is impossible to load a manim.cfg in the working directory as we can when doing from CLI.

IMO t's because of these lines (and more particular the else statement):

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 = '', '', ''

We have discussed that previously on discord with @leotrs and @XorUnison , sorry if I missed something ;).

@huguesdevimeux huguesdevimeux changed the title Impossible to use a custom manom.cfg when NOT running from CLI Impossible to use a custom manim.cfg when NOT running from CLI Jul 8, 2020
@leotrs
Copy link
Contributor

leotrs commented Jul 8, 2020

Ah you're right! I guess that inner else clause should also be outside, so that manim always checks for a local file, regardless of how it's being called. Sounds like an easy PR ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:bugfix Bug fix for use in PRs solving a specific issue:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants