-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Unexpected config error when a default config file is empty #367
Comments
@victor-yon thank you for reporting! You are right. The recommended steps to create a config should not fail just because |
…les used due to the config file initially being empty (#367).
…les used due to the config file initially being empty (#367).
@victor-yon I created pull request #370 fixing this. Please try it out. |
Hi, thank you for the fix. I can try next Monday, I don't have access to my computer before. |
…les used due to the config file initially being empty (#367).
Merged it since I wanted to create a release and this change was simple. You can test it next week with the released package. If there are issues, please comment here. |
I confirm that is working as expected with |
🐛 Bug report
If at least one
default_config_files
is set and this file is empty, aTypeError: Unexpected config:
is triggered onparser.parse_args()
. Even if no argument is mandatory.To reproduce
no 'config.yaml' file
Work as expected, no error
empty 'config.yaml' file
touch config.yaml python main.py > Unexpected config error:
Not empty 'config.yaml' file
Work as expected, no error
Expected behavior
I expect to have the same behavior between no configuration file and empty configuration file.
In the case where every argument are optional I don't expect to have an error.
In my case I wanted to generate this default configuration file as suggest in the document with:
python example.py --print_config > config.yaml
But an empty file is created before to run the script. Which trigger the issue mentioned above.
Environment
pip install jsonargparse[signatures]~=4.24 docstring-parser~=0.15 PyYAML~=6.0 ruyaml~=0.91
The text was updated successfully, but these errors were encountered: