Questions tagged [python-dotenv]

For questions related to `python-dotenv` library which reads the key-value pair from `.env` file and adds them to the environment variable.

Library Pypi page: https://pypi.org/project/python-dotenv/

There are plenty of alternative implementations: https://pypi.org/search/?q=dotenv

Other runtimes:

39 questions
1
vote
1 answer

Environment variables not being accessed in Python script on VSCode

I am creating a simple app that connects to an API and stores specific data into a list. In order to connect to the API, I must do BasicAuth with an email and password. Whenever I hardcode my email and password into the Python script, it works…
0
votes
0 answers

For python-dotenv, is it better practice to use dotenv.load_dotenv() or dotenv.dotenv_values(".env")?

Is it better practice to use dotenv.load_dotenv() or dotenv.dotenv_values(".env")? In most examples that I've seen, people use load_dotenv(), with the os module. Is this better than simply using the dotenv_values(), which just returns a dict? Or are…
kcx1
  • 31
  • 2
0
votes
0 answers

"no module named 'dotenv'" in when trying to set up autogpt

When im trying to set up auto gpt like this: PS C:\Users\******\Downloads\Auto-GPT-master> python3 c:\Users\******\Downloads\Auto-GPT-master\Auto-GPT-master\main.py This error appears: Traceback (most recent call last): File…
0
votes
0 answers

Why is Sphinx auto-documentation causing python-dotenv problems?

I'm working with sphinx to document a python project, but its not integrating well with python-dotenv. When running .\make, I'll get a warning that boils down to: logging.getLogger(config['APP_NAME']) KeyError: 'APP_NAME' This led me to see if my…
TheDeafOne
  • 93
  • 10
0
votes
0 answers

pipenv: "python-dotenv" reappearing after every pipenv install

every time i run pipenv install it will reinstall python-dotenv. I was using python-dotenv for a while, but I want to use django-dotenv instead. So, I want to remove it, hence i execute: $ pipenv uninstall python-dotenv $ pipenv graph | grep…
Soraphis
  • 706
  • 7
  • 26
0
votes
0 answers

getenv()s return None when using Pycharm's Play button

I am using: from dotenv import load_dotenv from os import getenv load_dotenv("config/.env") in a project which uses the pytest & selenium package. I use getenv("example_string") at various points in this file which imports from a .env file. The…
tonitone120
  • 1,920
  • 3
  • 8
  • 25
0
votes
0 answers

Run pytest in Azure pipeline utilizing environment variables from the Application Settings

We have a Flask app that is utilizing variables from Application Settings in Azure via python-dotenv's load_dotenv() method and os.environ in the code. I have tests in pytest that are referencing these same environment variables. I am able to add…
0
votes
1 answer

How do you add environment variables to a python scrapy project? dotenv didn't work

I'm having trouble incorporating an IP address into a format string in my Python Scrapy project. I was trying to use python-dotenv to store sensitive information, such as server IPs, in a .env file and load it into my project, instead of hardcoding…
rom
  • 666
  • 2
  • 9
  • 31
0
votes
2 answers

Default variables with python-dotenv

I want to make a package that works out of the box with reasonable default variables, like defining some servers, ports etc. so that the code works for an average user like he expects it without further configuration. But I want this environment…
FordPrefect
  • 320
  • 2
  • 11
0
votes
0 answers

OSError: Starting path not found (dotenv-0.21.0-py3.9.egg) (python)

I'm developing a script in Python 3.9 that works perfectly on my personal PC. When I tried moving and running it on a server, it gives me the following error: there the error Does anyone know how to fix this error? Laptop version: 3.10.7 server…
0
votes
1 answer

How to use variables from an environment file Python?

I have a project that I'm working on in which I need to store sensitive information into an environment file as variables that can later be called in my code. I'm having issues with it working and so I've dumbed it down to the simplest test I can…
0
votes
1 answer

Trying to place postgresql database information inside a dotenv file to hide important info, like passwords etc

I'm using the django rest framework and trying to connect a postgresql database. If I have the connection to the database written explicitly in the settings.py file, running python manage.py runserver works fine, but as soon as I replace the…
mdaw11
  • 166
  • 9
0
votes
1 answer

ModuleNotFoundError: No module named 'dotenv'

Facing dotenv not found error. % flask run * Tip: There are .env or .flaskenv files present. Do "pip install python-dotenv" to use them. * Environment: production WARNING: This is a development server. Do not use it in a production…
mesh
  • 849
  • 9
  • 16
0
votes
1 answer

ImportError: cannot import name 'load_dotenv' from 'dotenv'

I am trying to import load_dotenv from dotenv using: from dotenv import load_dotenv But I am getting the following error: ImportError: cannot import name 'load_dotenv' from 'dotenv'…
0
votes
0 answers

how to get updated .env values in python?

file structure: |_ login.py |_ main.py |_ .env login.py has function called login() that logs user in and sets token in .env file. .env file gets updated, but when I try to access the new updated token in main.py it gives me old…
soul
  • 29
  • 9