Skip to content

Python Terminal environment activation doesn't handle whitespaces in path correctly #1548

Description

Environment data

  • VS Code version: 1.22.2
  • Extension version (available under the Extensions sidebar): 2018.3.1
  • OS and version: Windows 10
  • Python version (& distribution if applicable, e.g. Anaconda): Anaconda 5.1.0

Actual behavior

For activation of an environment with whitespaces in the path the extension executes a line of the form
& cmd /k ""C:/Program Files (x86)/.../activate.bat" & powershell"
in the PowerShell terminal. The dots are placeholders. This way the first two quotes are treated as an empty string and the command can not be parsed by cmd.exe.

Expected behavior

The nested quotes need to be properly escaped. For example by doubling the inner quotes:
& cmd /k """C:/Program Files (x86)/.../activate.bat"" & powershell"
or by making the outer quotes single quotes:
& cmd /k '"C:/Program Files (x86)/.../activate.bat" & powershell'
both of which would be proper ways to deal with nested quotes in PowerShell and lead to the desired execution of activation.bat.

Steps to reproduce:

  1. Install an Anaconda distribution under a path that contains directories with whitespaces in their names
  2. Select this distribution as Python interpreter in VS Code with Python Extension and default settings
  3. call ">Python: Create Terminal"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions