I needed to use the dotenv module in Python. I tried the usual
pip install dotenv
Wohoo! I was able to import dotenv without any trouble. It was easy enough to install. Python is so intuitive, right? Well, not in this one case. When I ran my script, I kept getting the error:
AttributeError: ‘module’ object has no attribute ‘load_dotenv’
Eh? dotenv imports fine. So what could the issue be? I launched the Python interpreter and did
Turns out that the dotenv module did not have a load_dotenv method. A little bit of Googling shows that there is another python-dotenv package that also installs the dotenv module. Not cool, Python! So to get past my error, I uninstalled the seemingly intuitive dotenv package and then installed the python-dotenv.
pip uninstall dotenv
pip install python-dotenv
And now my script works.
© 2013-2017, Arunkumar Muralidharan. All rights reserved.