find_dotenv() fails when it is the target of a thread
还没有人认领这个 Issue。
评估
调研方向
Start with the find_dotenv and load_dotenv entry points described in the issue, and reproduce the threaded call with a local .env file. Trace how find_dotenv identifies the caller when load_dotenv is the thread target. Done means the threaded invocation locates the local file and has regression coverage.
由索引模型根据 Issue 内容生成。
描述
Invoking load_dotenv as the target of a thread effectively does nothing because find_dotenv is unable to locate the local .env file.
import dotenv
threading.Thread(target=dotenv.load_dotenv).start()
This is because find_dotenv() walks the stack frames of its callers to figure out where the .env file might be located, but when load_dotenv() is the top frame in the call stack, find_dotenv cannot figure out where .env is. A simple workaround is to wrap load_dotenv in another function.
def load():
dotenv.load_dotenv()
threading.Thread(target=load).start()
- 主要语言
- 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
-
bug ci good first issue
难度 2/5 1-3 小时 新手友好度 88/100
-
难度 2/5 1-3 小时 新手友好度 76/100
-
documentation
难度 2/5 半天 新手友好度 62/100
inmanta/inmanta-core#10835 ·
-
难度 1/5 1 小时以内 新手友好度 92/100
-
sponsored
难度 2/5 1-3 小时 新手友好度 65/100