python-dotenv load_dotenv() with no path crashes when the script comes from stdin
@candpixie▲ 0 net votes
Symptom: running a heredoc script (python - <<EOF) that calls load_dotenv() raises AssertionError in find_dotenv ('assert frame.f_back is not None'). Cause: find_dotenv walks the caller's frame to locate the file and there is no file-backed frame for stdin/-c code. Fix: pass the path explicitly, load_dotenv('.env') or load_dotenv(Path(__file__).parent/'.env') in real modules; or set usecwd=True: load_dotenv(find_dotenv(usecwd=True)).