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

missing config option should error out with user prompt #13029

Closed
wants to merge 1 commit into from

Conversation

trammell
Copy link
Contributor

@trammell trammell commented Apr 5, 2024

In the current releases of 3.8.x, when running rasa data validate if config.yml does not exist, failing to specify the path to the config file with --config results in a stack trace:

Traceback (most recent call last):
  File "/.../python-3.10/bin/rasa", line 8, in <module>
    sys.exit(main())
  File "/.../python-3.10/lib/python3.10/site-packages/rasa/__main__.py", line 133, in main
2024-04-05 12:40:25 DEBUG    urllib3.connectionpool  - Starting new HTTPS connection (1): o251570.ingest.sentry.io:443
    cmdline_arguments.func(cmdline_arguments)
  File "/.../python-3.10/lib/python3.10/site-packages/rasa/cli/data.py", line 124, in <lambda>
    args.fail_on_warnings, args.max_history, _build_training_data_importer(args)
  File "/.../python-3.10/lib/python3.10/site-packages/rasa/cli/data.py", line 175, in _build_training_data_importer
    return TrainingDataImporter.load_from_config(
  File "/.../python-3.10/lib/python3.10/site-packages/rasa/shared/importers/importer.py", line 119, in load_from_config
    config = read_config_file(config_path)
  File "/.../python-3.10/lib/python3.10/site-packages/rasa/shared/utils/yaml.py", line 400, in read_config_file
    return read_validated_yaml(filename, CONFIG_SCHEMA_FILE, reader_type)
  File "/.../python-3.10/lib/python3.10/site-packages/rasa/shared/utils/yaml.py", line 530, in read_validated_yaml
    content = read_file(filename)
  File "/.../python-3.10/lib/python3.10/site-packages/rasa/shared/utils/io.py", line 113, in read_file
    with open(filename, encoding=encoding) as f:
TypeError: expected str, bytes or os.PathLike object, not NoneType

Proposed changes:

  • change the value of none_is_valid to False in the call to get_validated_path()

Status (please check what you already did):

  • added some tests for the functionality
  • updated the documentation
  • updated the changelog (please check changelog for instructions)
  • reformat files using black (please check Readme for instructions)

@trammell trammell requested a review from a team as a code owner April 5, 2024 22:15
@trammell trammell closed this Apr 8, 2024
@trammell trammell deleted the handle-missing-config branch April 8, 2024 21:40
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

Successfully merging this pull request may close these issues.

1 participant