theskumar / theskumar/python-dotenv
find_dotenv() fails when it is the target of a thread
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 8.9k
- Fork
- 581
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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()
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- devops
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100