You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
os.PathLike is a generic type and should have a type argument. I think the correct typing for dotenv_path should be Union[str, os.PathLike[str], os.PathLike[bytes], None].
The text was updated successfully, but these errors were encountered:
eaftan
added a commit
to eaftan/python-dotenv
that referenced
this issue
Oct 20, 2022
* Fix type hint for load_dotenv
Fixes#431
* Quote type hints to avoid runtime errors in earlier Python versions
* Revise type of dotenv_path parameter
Based on PR feedback and typeshed's type hint for the built-in open()
function:
https://github.com/python/typeshed/blob/e2d67bf7034f68c07bd35150247e58e0817725d9/stdlib/builtins.pyi#L1421
* Allow only string paths, not byte paths
These paths can flow into `shutil.move`, which does not accept byte
paths or (int) file descriptors. See python/typeshed#6832
* Create a type alias for the paths this library accepts
And use it consistently in main.py.
Steps to reproduce:
I think the problem is that
load_dotenv
is typed as follows:os.PathLike
is a generic type and should have a type argument. I think the correct typing fordotenv_path
should beUnion[str, os.PathLike[str], os.PathLike[bytes], None]
.The text was updated successfully, but these errors were encountered: