environment-variables

Why PyCharm does not recognize user environment variables configuration?

Why PyCharm does not recognize user environment variables configuration? Question: I tried to use the PyCharm user environment variable configuration, however, it throws KeyError. If I try to set the variables via commands it works, but via configuration it does not. I will appreciate any help. import os print(os.environ[‘BLA’]) (venv) (base) mikam@Mikas-MacBook-Pro Scripts % python …

Total answers: 3

Why I can't access my environment variable from .env file in vscode python?

Why I can't access my environment variable from .env file in vscode python? Question: I am really new to the space so sorry if my questioning is bad or I ask novice questions. also thanks in advance for the repliers! what I am trying to do? I am trying to access my environment variable from …

Total answers: 4

Reading environment variables from more than one ".env" file in Python

Reading environment variables from more than one ".env" file in Python Question: I have environment variables that I need to get from two different files in order to keep user+pw outside of the git repo. I download the sensitive user+pass from another location and add it to .gitignore. I am using from os import getenv …

Total answers: 3

Setting Environment variables in .venv

Setting Environment variables in .venv Question: I am using .venv to create a virtual environment to use for a project. Within this project, I need to access the OpenAI GPT3 environment. For this, i have an API key, but I want to store it as an environment variable. Because I use windows and VS-Code to …

Total answers: 3

How to mask environment variables created in Github when running a workflow?

How to mask environment variables created in Github when running a workflow? Question: I created a Github workflow that runs a python script with a cron schedule. On every run of the workflow an access_token is generated, which is required during the next run. To save the token the python script writes the token to …

Total answers: 2

I keep getting 'None' when getting enviroment variables

I keep getting 'None' when getting enviroment variables Question: I’m trying to keep my token in an enviroment variable, so I created the file .env, and I stored the TOKEN there: TOKEN=XXX When I run my .py file, I can’t get the enviroment variable TOKEN, it keeps printing ‘None’. import os token = os.environ.get("TOKEN") print(token) …

Total answers: 2

How to set environment variable based on development or production in FastAPI?

How to set environment variable based on development or production in FastAPI? Question: I want to have different environment variables based on development and production but i can’t seem to find anything related to this topic for FastAPI. Is it possible that i can have .env, .env.local, .env.prod to have different environment variables Asked By: …

Total answers: 3

Does "pipenv install requests" work with python 3.9.2?

Does "pipenv install requests" work with python 3.9.2? Question: I am following a guide to get NLTK working on my computer and part of the process is setting up a virtual environment so I can manage packages across projects. Here is the guide I’m following: https://docs.python-guide.org/dev/virtualenvs/ I run into an issue when I reach the …

Total answers: 1

Environment Variable not loading with load_dotenv() in Linux

Environment Variable not loading with load_dotenv() in Linux Question: I’m trying to make a discord bot, and when I try to load a .env with load_dotenv() it doesn’t work because it says Traceback (most recent call last): File "/home/fanjin/Documents/Python Projects/Discord Bot/bot.py", line 15, in <module> client.run(TOKEN) File "/home/fanjin/.local/lib/python3.8/site-packages/discord/client.py", line 708, in run return future.result() File …

Total answers: 6

'py' works but not 'python' in command prompt for windows 10

'py' works but not 'python' in command prompt for windows 10 Question: I installed Python on my computer. When I type python in the command prompt I get the following message: ‘python’ is not recognized as an internal or external command, operable program or batch file. But when I type py it seems to be …

Total answers: 3