-
Notifications
You must be signed in to change notification settings - Fork 425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variable not found ("None" returned) on a Mac #104
Comments
This is also something we're running into as well. |
Same as well. Working on High Sierra, Python 3.5 |
@theskumar Several people seem to be having this issue - would really appreciate your help on this one! Thanks in advance. |
@shirki can you try providing absolute path to .env file or use |
I've tried running your example on Mac, it works with: python-dotenv==0.8.2 |
I have the same problem as others here. If I use |
@theskumar Neither python-dotenv: 0.8.2 |
@shirki sorry for the issues you are facing. But I don't seem to able to reproduce the issue. One last time, I would just advice you to use the absolute path to the .env file. It could be file permission issue, but I can't say for sure. |
I tried running UserWarning: File doesn't exist
warnings.warn("File doesn't exist {}".format(self.dotenv_path)) I tried the other example in the doc: from pathlib import Path # python3 only
env_path = Path('.') / '.env'
load_dotenv(dotenv_path=env_path) which results in TypeError: argument should be string, bytes or integer, not PosixPath I I also tried: from dotenv import load_dotenv
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
env_path = os.path.join(BASE_DIR, '.env')
load_dotenv(dotenv_path=env_path, verbose=True) but still the same error. |
Daaaaamn.... I just realised my file was named Just renamed it to |
It happens no worries. |
@theskumar Can you please reopen the issue? I tested it again with python 3.6.5, as well as with an absolute filename or with the load function, and the issue persists. As opposed to @TDiazT, my file name is definitely .env 😄. No file permission issues either. Let me know what you need from me in order to reproduce the issue. As I mentioned, this is particularly with one mac and one PC on the same team. @devrsw, are you still getting the same error? Thanks! |
It happened to me as well on Docker/Ubuntu14.04. I had to explicitly load with
|
i'm on a mac, high sierra and I had the same issue until I changed it to:
|
This solved my issue: |
I had similar issue on Python 3.5 (working fine on later versions). What worked for me is using explicit path to .env. Assuming the env file is in projects folder, it can be loaded as follows:
|
I had similar issues where adding the path or find_dotenv() didn't work. I recreated my .env file to be sure it had the right extension and that fixed it. I'm guessing I messed something up creating the .env the first time somehow. |
Saw this issue and wanted to post what worked for me since none of the above fixes were working for my problem. I had trouble getting python-dotenv to work because I had jupyterlab installed in my conda (miniforge) base environment and had installed python-dotenv in a separate environment. python-dotenv wasn't recognizing the .env file correctly from jupyterlab and after a lot of trouble shooting all I had to do was install python-dotenv in my base conda env as well. Then load_dotenv() correctly recognized my .env file in the same folder as my notebook. Just wanted to post in case someone else had the same problem. |
Hi, we are using dotenv for a project and are getting strange behavior.
While the environment variable is working just fine on a Windows machine, it is not able to read at all on a Mac. It returns "None" even though the variable is clearly there. There seem to be no other issues.
In X.py file:
In .env file:
While running:
This is on Sierra, Python 3.6.2.
As mentioned above, the same code runs just fine on a PC.
Any help would be appreciated!
The text was updated successfully, but these errors were encountered: