Skip to content

pjgoodall/test_vscode_env

Repository files navigation

Visual Studio Code .env file does not provide access to PYTHONPATH

Update

I have updated my test source test_PYTHONPATH.py to allow it to trap library and environment access exceptions.

Please note the difference between the vscode 'run' and 'debug' results. You may see different effects depending on history of establishing the content of the .env file. I don't think there is an automatic update of the environment when .env is edited. I have seen it scanned when I changed the python environment to another and back again, otherwise the edits dont seem to have an effect.

Links

microsoft/vscode#94338

files are in github repository https://github.com/pjgoodall/test_vscode_env

Problem

I expect to be able to import from modules with subdirectories of the vscode workplaceFolder. If I try to append to PYTHONPATH using the environment file: ${workspaceFolder}/.env, I get an empty reference to PYTHONPATH within that file. I therefore cannot add the path to my modules to PYTHONPATH from ${workspaceFolder}/.env

I do not want to hard-code a manipulation of the environment into my python source.

This may be an interaction complexity between vscode and conda virtual environments

References

vscode documentation

Files:

  1. test_PYTHONPATH.py python code which tests access to environment variables - particularly PYTHONPATH altered in ${workspaceFolder}/.env
  2. environment.yml used to create working conda virtual python environment
  3. python_modules - a directory I want to be on my PYTHONPATH so I can import modules from within it.
  4. README.md - this file
  5. Screenshot from 2020-04-03 15-34-53.png - vscode screenshot showing settings related to ${workspaceFolder}/.env

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages