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

Gin does not support pathlib, gpath and the __fspath__ protocol #165

Closed
Conchylicultor opened this issue Apr 21, 2022 · 1 comment
Closed

Comments

@Conchylicultor
Copy link
Member

Currently, gin is not compliant with PEP 519.

Modern Python file system operations uses pathlib-like API. Which is not supported by gin:

path = pathlib.Path('/path/to/c.gin')

gin.parse_config_files_and_bindings(path)  # Error

It is very easy to solve. Function should normalize pathlib-like object, like:

path = os.fspath(path)  # Convert pathlib & cie -> str

To check whether an object is a pathlib object:

isinstance(path, (str, os.PathLike))
@Conchylicultor
Copy link
Member Author

My bad. It was my mistake in the previous example (parse_config_files_and_bindings([path]))

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