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

Handle pathlib Path used as default_config_files #293

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

YoannQDQ
Copy link

Having Path objects in the default_config_files make it impossible to display the help (-h) message

from pathlib import Path

import configargparse

p = configargparse.ArgumentParser(default_config_files=[Path("~/.my_settings.ini")])
p.add("geotiff")
p.add("--flag", help="Flag that can be set in the config file")

options = p.parse_args()

Running the above snippet with -h will trigger a TypeError: sequence item 0: expected str instance, PosixPath found.

This PR just casts the default_config_files to str in the help message.

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