Skip to content
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

readalongs -c switch should validate file contents, not extension #140

Open
joanise opened this issue Dec 16, 2022 · 1 comment
Open

readalongs -c switch should validate file contents, not extension #140

joanise opened this issue Dec 16, 2022 · 1 comment

Comments

@joanise
Copy link
Member

joanise commented Dec 16, 2022

Right now, the config.json file passed through -c must have the .json extension. That's overly picky. We ought to accept any file that's valid JSON.

This by itself would be enough in cli.py:

            try:
                with open(config_file, encoding="utf-8-sig") as f:
                    config = json.load(f)
            except json.decoder.JSONDecodeError as e:
                raise click.BadParameter(
                    f"Config file at {config_file} is not in valid JSON format: {e}."
                ) from e

we don't really need to wrap it in if str(config_file).endswith("json"): as we do.

@dhdaines
Copy link
Collaborator

Lol! Yes, indeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants