question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.env file evaluation appends original string

See original GitHub issue

Possibly 2 issues? When using a .env file, a value placed in the form of:

PYTHONPATH=$PYTHONPATH:$PWD/django/project:$PWD/django/project/vendor

Does not evaluate the variables. It sets it literally not the evaluated version.

>>> import os
>>> os.environ['PYTHONPATH']
'${PYTHONPATH}:${PWD}/django/project:${PWD}/django/project/vendor'

When specifying the values as:

PYTHONPATH=${PYTHONPATH}:${PWD}/django/project:${PWD}/django/project/vendor

PWD and PYTHONPATH are evaluated, but the original string is still prepended, leaving something like this as the final value that is set as the value of PYTHONPATH

>>> import os
>>> os.environ['PYTHONPATH']
'${PYTHONPATH}:${PWD}/django/project:${PWD}/django/project/vendor:/Users/aventurella/github/my_repo/django/project:/Users/aventurella/github/my_repo/django/project/vendor'

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
matthiasLevycommented, Jan 17, 2018

Thanks ! It is not my favorite option, but does the job perfectly. Regards, M.

0reactions
matthiasLevycommented, Jan 17, 2018

This is very interesting. Thanks again, it will certainly bu useful soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Workaround to docker run "--env-file" supplied file not being ...
creating an ENV file that is nothing more than key/value pairs can be processed in normal shell commands and appended to the environment....
Read more >
How to use .env file in JavaScript applications with webpack
env file. npm init. First of all, we need to create the package.json file by running: npm init.
Read more >
Replace environment variables in a file with their actual values?
I want to replace $INSTANCE_ID in the file with the value of the INSTANCE_ID environment variable, $SERVICE_NAME with the value of the ...
Read more >
Environment variables and app settings in Azure App Service
Signifies a connection string to a custom file share. Deployment. The following environment variables are related to app deployment. For ...
Read more >
How to separate your credentials, secrets, and configurations ...
env.example file. dotenv with Python. Let's demonstrate with the python-dotenv library first. The example console application uses the library ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found