Open
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()
Metadata
Assignees
Labels
No labels