Skip to content

Instantly share code, notes, and snippets.

@piersharding
Created February 17, 2019 23:52
Show Gist options
  • Save piersharding/288aa79601168ebf3ca3cdd46de087f1 to your computer and use it in GitHub Desktop.
Save piersharding/288aa79601168ebf3ca3cdd46de087f1 to your computer and use it in GitHub Desktop.
Wrapper for .env vars for vscode-python broken-ness - https://github.com/Microsoft/vscode-python/issues/944
#!/bin/sh
# environment fix for vscode-python problems https://github.com/Microsoft/vscode-python/issues/944
# stick this in ${workspaceFolder}/venv/bin/python.sh and adjust settings.json:
# "python.pythonPath": "${workspaceFolder}/venv/bin/python.sh",
# "python.envFile": "${workspaceFolder}/dev.env",
# "python.terminal.activateEnvironment": true,
# "python.venvPath": "${workspaceFolder}/venv"
# ...
echo "Current path is " `pwd`
# load environment variables
if [ -f .env ]; then
export $(grep -v '^#' .env | xargs)
fi
venv/bin/python $*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment