Incorrect file is sourced when terminal activates virtual env
See original GitHub issueEnvironment data
- VS Code version: 1.38.0-insider (user setup)
- Extension version (available under the Extensions sidebar): 2019.8.30787
- OS and version: Ubuntu 16.04
- Python version (& distribution if applicable, e.g. Anaconda): 3.6.9
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): Pipenv
- Relevant/affected Python packages and their versions: XXX
- Jedi or Language Server? (i.e. what is
"python.jediEnabled"
set to; more info #3977): language server
Expected behaviour
Welcome to fish, the friendly interactive shell
$ source /home/username/projectA/.venv/bin/activate.fish
$
Actual behaviour
Welcome to fish, the friendly interactive shell
$ source /home/username/projectA/.venv/bin/activate
~/projectA/.venv/bin/activate (line 82): Missing end to balance this if statement
if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then
^
from sourcing file ~/projectA/.venv/bin/activate
called on standard input
source: Error while reading file “/home/username/projectA/.venv/bin/activate”
$
Steps to reproduce:
- This happens intermittently and not every time a new terminal is started. Just start a new terminal and “hope” the problem happens. For some reason it sometimes do not source the .fish specific venv activation file. I think this only sometimes happen when you open a new terminal after VS Code has been opened. Closing & re-opening the terminal multiple times does not seem to trigger the fault.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8
Top Results From Across the Web
virtualenv - Getting a 'source: not found' error when using ...
I'm trying to write (what I thought would be) a simple bash script that will: run virtualenv to create a new environment at...
Read more >Pycharm Terminal fails to activate virtual env
When I click Terminal, it does not activate the virtualenv environment. How to recreate: I create a new project, selecting the option to......
Read more >Python Virtual Environments: A Primer
In this tutorial, you'll learn how to work with Python's venv module to create and manage separate virtual environments for your Python ......
Read more >Using Python environments in VS Code
Using Python environments in VS Code. This article discusses the helpful Python environments features available in Visual Studio Code. An "environment" in ...
Read more >Cannot activate - Python
I created a virtualenv for python, and I am trying to activate it with source ... function, script file, path is correct and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Alright, maybe a VSCode thing. I am closing this for now, if the issue re-occurs I’ll be happy to reopen and work on it.
@falkben I am able to confirm this, but this not reproducible in insiders anymore (which carries the latest version). Which means it should be fixed in the latest version of vscode.
@thernstig Thanks for reporting, but that’s a separate issue. It’s being tracked here. https://github.com/microsoft/vscode-python/issues/4203 https://github.com/microsoft/vscode-python/issues/5664. Terminal issues in general are tracked here https://github.com/microsoft/vscode-python/issues/4568. Should be fixed soon enough.
The issues seems to be addressed in the latest version, so closing this, thanks for reporting again!