find_dotenv() fails when it is the target of a thread
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
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.
Written by the indexing model from the issue text.
Description
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()
- Dominant language
- Python
- Stars
- 8.9k
- Forks
- 581
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from theskumar/python-dotenv
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
theskumar/python-dotenv#699 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
theskumar/python-dotenv#697 ·
-
Difficulty 5/5 Over a week Newbie friendliness 28/100
theskumar/python-dotenv#693 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
theskumar/python-dotenv#683 · 4 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
theskumar/python-dotenv#644 · 2 comments ·
All issues in theskumar/python-dotenv
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
triage/confirmed
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
agentscope-ai/agentscope#2775 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
comp/desktop P3 type/bug
Difficulty 1/5 Under an hour Newbie friendliness 92/100
NousResearch/hermes-agent#118866 ·