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.

Incorrect file is sourced when terminal activates virtual env

See original GitHub issue

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 #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.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:8

github_iconTop GitHub Comments

2reactions
karrtikrcommented, Sep 14, 2019

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.

1reaction
karrtikrcommented, 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. 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!

Read more comments on GitHub >

github_iconTop 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 >

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