load_dotenv() default behavior change in PyCharm interactive console
还没有人认领这个 Issue。
评估
调研方向
Start by reproducing the reported load_dotenv() and find_dotenv(usecwd=True) calls in a PyCharm interactive console with the .env file in the project root, comparing package versions 1.0.0 and 1.0.1+. Trace the default path-selection entry point and add or update regression coverage for the console scenario; done means the intended behavior is documented and verified.
由索引模型根据 Issue 内容生成。
描述
Python Versions tested: 3.10, 3.11, 3.12.10
Environment: Windows (10, 11) in PyCharm interactive console
Affected package versions: 1.0.1+
When using the pycharm interactive console, the following code no longer finds the .env file by default (as of version 1.0.1).
from dotenv import load_dotenv
load_dotenv()
When testing in version 1.0.0, the load_dotenv() function will correctly find the .env file without any additional arguments. In order to successfully load a .env file located within the project's root directory, the following code must be used.
from dotenv import load_dotenv, find_dotenv
load_dotenv(find_dotenv(usecwd=True))
From reading the documentation, it suggests that find_dotenv() doesn't use the CWD by default and works based upon the calling file's location. This creates somewhat unexpected behavior for use in pycharm's interactive console. I wouldn't have expected a change in default behavior like this in a patch release.
PyCharm and Env file Notes
- .env file is located in the project's root directory
- PyCharm console is running in the project's root directory
- 主要语言
- Python
- 星标
- 8.9k
- 派生
- 581
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
theskumar/python-dotenv 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
theskumar/python-dotenv#699 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 35/100
theskumar/python-dotenv#697 ·
-
难度 5/5 一周以上 新手友好度 28/100
theskumar/python-dotenv#693 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 55/100
theskumar/python-dotenv#683 · 4 条评论 ·
-
难度 3/5 1-2 天 新手友好度 55/100
theskumar/python-dotenv#644 · 2 条评论 ·
查看 theskumar/python-dotenv 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
难度 2/5 1-3 小时 新手友好度 88/100
OpenHands/extensions#626 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
CSCfi/sd-search-api#39 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
-
难度 2/5 1-3 小时 新手友好度 68/100
StevenBlack/hosts#3255 ·