Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect file is sourced when terminal activates virtual env #7111

Closed
thernstig opened this issue Aug 27, 2019 · 8 comments
Closed

Incorrect file is sourced when terminal activates virtual env #7111

thernstig opened this issue Aug 27, 2019 · 8 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@thernstig
Copy link

thernstig commented Aug 27, 2019

Environment 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 How to update the language server to the latest stable version #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:

  1. 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.
@thernstig thernstig added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Aug 27, 2019
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Aug 27, 2019
@karrtikr karrtikr self-assigned this Aug 27, 2019
@karrtikr
Copy link

Hi @thernstig, I don't have access to fish shell at the moment. I will be getting back to you shortly.

@karrtikr karrtikr added the info-needed Issue requires more information from poster label Aug 30, 2019
@karrtikr
Copy link

Unfortunately I am not able to reproduce this flaky behavior. For me it always uses activate.fish to activate. However there are some changes we are making regarding #7343, so please check that.

If you can give me a reproducible case, I'll happy to work on this.

Do you face the same issue @falkben? Can you please give a reproducible case as well.

@thernstig
Copy link
Author

@karrtikr I have not seen this behavior in 2 weeks now. I will keep monitoring and when it happens, really try to think of exactly what I did. Could it potentially be that the VS Code code-base itself (the terminal parts (xterm)) could have fixed this somehow? In any case, I will keep trying to look for it and promise to come back if I found it, and if I do not within 2 weeks I think we can close this. At least the issue is documented and can be re-opened if someone else sees it.

@falkben
Copy link

falkben commented Sep 14, 2019

I'm not seeing this now either. I feel like it's happened within the last 2 weeks though. Will also report back if I see it happen again.

@karrtikr
Copy link

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.

@ghost ghost removed the triage label Sep 14, 2019
@falkben
Copy link

falkben commented Sep 18, 2019

Got the error on Windows WSL (ubuntu) this time on vscode standard, not insiders:

source /home/ben/repos/zootable/venv/bin/activate
~/repos/zootable/venv/bin/activate (line 74): Missing end to balance this if statement
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
^
from sourcing file ~/repos/zootable/venv/bin/activate
        called on standard input

source: Error while reading file “/home/ben/repos/zootable/venv/bin/activate”

If I close the terminal and reopen, it activates without error. This seems to only happen when I first start vscode with the terminal closed and a python file open in the editor. When I open the terminal, for the first time, it tries to activate the virtual environment but I get that error. Repeatable.

@karrtikr karrtikr reopened this Sep 18, 2019
@ghost ghost added the triage-needed Needs assignment to the proper sub-team label Sep 18, 2019
@karrtikr karrtikr added triage and removed triage-needed Needs assignment to the proper sub-team labels Sep 18, 2019
@thernstig
Copy link
Author

thernstig commented Sep 23, 2019

I was able to reproduce this by launch a debug session (for current Pytho file). It opens the terminal "slowly" and thus the problem happens. It is some race condition I'd wager that happens when the terminal is slow to open.

@karrtikr
Copy link

karrtikr commented Sep 23, 2019

@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. #4203 #5664. Terminal issues in general are tracked here #4568. Should be fixed soon enough.

The issues seems to be addressed in the latest version, so closing this, thanks for reporting again!

@ghost ghost removed the triage label Sep 23, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Sep 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

3 participants