bowhead
bowhead copied to clipboard
dotenv.load 'module' object has no attribute 'load'
White going through the tutorial on ubuntu server trying to do the command screen python streaming.py I originally got the error import request not available. after installing python reqest, no clue how I figured that one out, I got the error dotenv not included. did the same as before and now i'm getting the error listed above in the title section. I used pip install dotenv. Uninstalled that one and then used pip install python-dotenv. still no luck. tried django python dotenv. still no luck. I must be doing something wrong. Please help.
Do you have pip installed and up to date?
there is another option as well, which is the non-streaming version, I made a note about it on the first article.
-joel
On Mon, Jul 31, 2017 at 2:12 PM, jeremiahtenbrink [email protected] wrote:
White going through the tutorial on ubuntu server trying to do the command screen python streaming.py I originally got the error import request not available. after installing python reqest, no clue how I figured that one out, I got the error dotenv not included. did the same as before and now i'm getting the error listed above in the title section. I used pip install dotenv. Uninstalled that one and then used pip install python-dotenv. still no luck. tried django python dotenv. still no luck. I must be doing something wrong. Please help.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/joeldg/bowhead/issues/19, or mute the thread https://github.com/notifications/unsubscribe-auth/AOT1lWAu2Ojdy3-yb9VikApjZ1BTD9sfks5sTkNLgaJpZM4Oo72A .
-- Joel De Gan Vice President of Technology
Mobile: (646) 724-0451 Email: [email protected] Skype: joel-dg
2320 Abbot Kinney Blvd, Suite A Venice, CA 90291 www.RxMG.com http://www.rxmg.com/
I get the same error.
python streaming.py
Traceback (most recent call last):
File "streaming.py", line 90, in <module>
main()
File "streaming.py", line 86, in main
demo(displayHeartbeat)
File "streaming.py", line 56, in demo
response = connect_to_stream()
File "streaming.py", line 28, in connect_to_stream
dotenv.load()
AttributeError: 'module' object has no attribute 'load'
pip --version
pip 1.5.6 from /usr/lib/python2.7/dist-packages (python 2.7)
Observing exactly same pattern - Didn't have requests module and later dotenv module and later no dotenv.load . Did any of you got to debug this issue?
i have made progress on the above error but have run into more.
As per dotenv documentation you must now load your .env file like this
dotenv_path = join(dirname(__file__), '.env') load_dotenv(dotenv_path)
ok so i fixed a few more errors. The imports need to look like this
import requests import json import os from os.path import join, dirname from dotenv import load_dotenv from optparse import OptionParser
and the code for getting the oanda access tokens needs to look like this
access_token = os.getenv('OANDA_TOKEN') account_id = os.getenv('OANDA_ACCOUNT')
sorry for the bad formatting
is this fixed already?
I don't have experience with python and I'm getting the same error. Is there a fix for this already? what's the correct format? because as what I'v heard python is strict about spacing and formatting.
@aleksajovanovic pointed in the right direction, but I still wasn't able to fix it. In order to properly fix it, here's what I did:
- Install
requests
through as per this article.$ sudo pip install requests
; - Used the correct dotenv library. You must install
sudo pip install python-dotenv
. Turns out I had installed it throughsudo pip install dotenv
and that did not work. See here. - Edited the
streaming.py
code to match the correct usage ofpython-dotenv
. I have used
from os.path import join, dirname
from dotenv import load_dotenv
dotenv_path = join(dirname(__file__), '.env')
load_dotenv(dotenv_path)
# load the ENV variables as already done in streaming.py
You probably installed the wrong dotenv for python. I had the same issue, it was resolved by uninstalling my previously installed dotenv and using this command (as described in the readme): pip install python-env
.
as Jeppe says, use https://github.com/theskumar/python-dotenv
I can confirm that pip uninstall python-dotenv
and then pip install python-env
fixed the problem