AttributeError: ‘module’ object has no attribute ‘load_dotenv
2018-03-18 19:17
871 查看
AttributeError: ‘module’ object has no attribute ‘load_dotenv’
I needed to use the dotenv module in Python. I tried the usualpip 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:
dotenv.load_dotenv(os.path.join(MY_CURRENT_PATH,’.env’))
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
import dotenv
help(dotenv)
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.
相关文章推荐
- AttributeError: 'module' object has no attribute 'text_format'
- web.py 启动时候出现AttributeError: 'module' object has no attribute 'inet_pton'错误
- AttributeError: 'module' object has no attribute 的解决方法
- AttributeError: 'module' object has no attribute 'text_format'
- AttributeError: 'module' object has no attribute '_base' 可行解决办法
- 【TensorFlow问题】AttributeError:'module' object has no attribute 'mul'
- AttributeError: 'module' object has no attribute 'text_format'
- AttributeError: 'module' object has no attribute 'face' 问题解决 opencv+python
- AttributeError: 'module' object has no attribute 'histogram_summary'
- opencv AttributeError: 'module' object has no attribute 'CV_LOAD_IMAGE_COLOR'
- 【TensorFlow问题】AttributeError:'module' object has no attribute 'mul'
- AttributeError: 'module' object has no attribute 'detect'
- AttributeError: 'module' object has no attribute 'merge_all_summaries'
- AttributeError: 'module' object has no attribute 'Frame' 解决方法
- AttributeError: 'module' object has no attribute(转)
- AttributeError: 'module' object has no attribute 'LabelMap'
- opencv3:AttributeError: 'module' object has no attribute 'CV_LOAD_IMAGE_COLOR'
- AttributeError: 'module' object has no attribute 'XXX'
- AttributeError: 'module' object has no attribute '_handlerList' 错误解决方法
- AttributeError: 'module' object has no attribute 'SSL_ST_INIT' 解决办法