Apr '24 (edited) • 📚 Recommendations
Solution for find_dotenv returning empty string
I was trying to follow the tutorial by running load_dotenv(find_dotenv()) and was receiving empty string from find_dotenv.
Turned out find_dotenv() would start finding .env file in the python file directory instead of the project directory.
So if you have project structure like the following where my_script.py has the find_dotenv():
project/
└── scripts/ > my_script.py
└── .env
find_dotenv() will return empty string as it searches for .env file in the scripts folder instead of project folder. Got resolved by entering find_dotenv(usecwd=True).
2
1 comment
Lotus May
3
Solution for find_dotenv returning empty string
Data Alchemy
skool.com/data-alchemy
Your Community to Master the Fundamentals of Working with Data and AI — by Datalumina®
Leaderboard (30-day)
Powered by