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

Reporting invalid configuration extensions #130

Open
t00sa opened this issue Aug 22, 2023 · 0 comments
Open

Reporting invalid configuration extensions #130

t00sa opened this issue Aug 22, 2023 · 0 comments

Comments

@t00sa
Copy link
Contributor

t00sa commented Aug 22, 2023

If an invalid configuration file - e.g. a .txt file rather than a .py file - is passed to the CLI using the -configuration argument, the command reports that it is unable to find the file:

linux> touch empty.txt
linux> python -m stylist -configuration empty.txt check_nan_inf_mod.f90
Traceback (most recent call last):
  File "/net/project/ukmo/scitools/opt_scitools/conda/deployments/default-2023_05_04/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/net/project/ukmo/scitools/opt_scitools/conda/deployments/default-2023_05_04/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/var/tmp/persistent/stylist/source/stylist/__main__.py", line 203, in <module>
    main()
  File "/var/tmp/persistent/stylist/source/stylist/__main__.py", line 189, in main
    configuration = __configure(arguments.configuration)
  File "/var/tmp/persistent/stylist/source/stylist/__main__.py", line 111, in __configure
    configuration = load_configuration(project_file)
  File "/var/tmp/persistent/stylist/source/stylist/configuration.py", line 53, in load_configuration
    raise StylistException(message)
stylist.StylistException: Unable to find configuration file: empty.txt
linux> 

It would be better if the error indicated that the the file was invalid rather than reporting that it could not be found. This was spotted during testing for PR 123.

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

1 participant