{"id":2210,"date":"2014-12-31T06:54:19","date_gmt":"2014-12-31T11:54:19","guid":{"rendered":"http:\/\/qxf2.com\/blog\/?p=2210"},"modified":"2014-12-31T06:54:19","modified_gmt":"2014-12-31T11:54:19","slug":"attributeerror-module-object-no-attribute-load_dotenv","status":"publish","type":"post","link":"https:\/\/qxf2.com\/blog\/attributeerror-module-object-no-attribute-load_dotenv\/","title":{"rendered":"AttributeError: &#8216;module&#8217; object has no attribute &#8216;load_dotenv&#8217;"},"content":{"rendered":"<p>I needed to use the dotenv module in Python. I tried the usual <\/p>\n<blockquote><p>pip install dotenv<\/p><\/blockquote>\n<p>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:<\/p>\n<blockquote><p>dotenv.load_dotenv(os.path.join(MY_CURRENT_PATH,&#8217;.env&#8217;))<br \/>\n<strong>AttributeError: &#8216;module&#8217; object has no attribute &#8216;load_dotenv&#8217;<\/strong>\n<\/p><\/blockquote>\n<p>Eh? dotenv imports fine. So what could the issue be? I launched the Python interpreter and did <\/p>\n<blockquote><p>import dotenv<br \/>\nhelp(dotenv)<\/p><\/blockquote>\n<p>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.<\/p>\n<blockquote><p>pip uninstall dotenv<br \/>\npip install python-dotenv\n<\/p><\/blockquote>\n<p>And now my script works. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>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: dotenv.load_dotenv(os.path.join(MY_CURRENT_PATH,&#8217;.env&#8217;)) AttributeError: &#8216;module&#8217; object has no attribute [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2210","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/posts\/2210","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/comments?post=2210"}],"version-history":[{"count":7,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/posts\/2210\/revisions"}],"predecessor-version":[{"id":10228,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/posts\/2210\/revisions\/10228"}],"wp:attachment":[{"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/media?parent=2210"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/categories?post=2210"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/tags?post=2210"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}