Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
read_dotenv problem
#1
Hi

I am working with some sample code from ciscoAxl sdk

part of the sample code is this:

import os #for ciscoaxl sdk
from ciscoaxl import axl #for ciscoaxl sdk
from py_dotenv import read_dotenv
dotenv_path = os.path.join(os.path.dirname(__file__), '.env') #orig
read_dotenv(dotenv_path)
however when I run that, I get the following error.

Error:
Traceback (most recent call last): File "C:\Users\itsMe\eclipsePython-workspace\PythonTestMod\Demo.py", line 4, in <module> read_dotenv(dotenv_path) File "C:\Users\itsMe\AppData\Local\Programs\Python\Python36-32\lib\site-packages\py_dotenv\dotenv.py", line 10, in read_dotenv 'Not loading {} - it doesn\'t exists'.format(file_path) FileNotFoundError: Not loading C:\Users\itsMe\eclipsePython-workspace\PythonTestMod\.env - it doesn't exists
I tried it with quotes around the file "__file__" as suggested in a post somewhere but no luck.

It looks like it is returning most of the environment path, but I dont know what it is looking for with the .env at the end.

Can anyone give any suggestions?
thanks
Reply


Messages In This Thread
read_dotenv problem - by wolf8963 - Jan-24-2020, 04:21 AM
RE: read_dotenv problem - by Larz60+ - Jan-24-2020, 06:27 AM
RE: read_dotenv problem - by wolf8963 - Jan-25-2020, 04:37 AM
RE: read_dotenv problem - by buran - Jan-25-2020, 06:22 AM
RE: read_dotenv problem - by wolf8963 - Feb-06-2020, 07:23 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020