microsoft / vscode-python

Python extension for Visual Studio Code
https://aka.ms/pvsc-marketplace
MIT License
4.33k stars 1.19k forks source link

Special symbols in .env file issue #1727

Closed osya closed 6 years ago

osya commented 6 years ago

Environment data

Actual behavior

When you use .env file in the VS Code project and CMD.exe as terminal ("terminal.integrated.shell.windows": "cmd.exe") then for settings environment variables generated commands such as cmd /C "set "SECRET_KEY=uh_p8w$eo6%%tf5)d43b2y))88qxf2t9-s=osvq46u#3ya^p+" without escaping special symbols.

Expected behavior

Special symbols (such as & and ^) in the values of environment variables from the .env file in the set command should be escaped with the ^ symbol.

Steps to reproduce:

  1. Create .env file with the following content SECRET_KEY=uh_p8w$eo6%%tf5)d43b2y))88qxf2&t9-s=osvq46u#3ya^p+
  2. Create some .py file
  3. Create launch configuration for Python and ensure "envFile": "${workspaceFolder}/.env" in it (.env file used by default, so may be adding this line is not necessary)
  4. Start debugging In the Terminal the following error appears:
    >cd c:\Users\info_000\Desktop && cmd /C "set "SECRET_KEY=uh_p8w$eo6%%tf5)d43b2y))88qxf2&t9-s=osvq46u#3ya^p+" && set "PYTHONIOENCODING=UTF-8" && set "PYTHONUNBUFFERED=1" && python ...\.vscode\extensions\ms-python.python-2018.4.0\pythonFiles\PythonTools\visualstudio_py_launcher.py ...\Desktop 52380 34806ad9-833a-4524-8cd6-18ca4aa74f14 RedirectOutput,RedirectOutput ...\Desktop\.vscode\launch.json "
    't9-s' is not recognized as an internal or external command,
    operable program or batch file.

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

##########Linting Output - pep8##########
##########Linting Output - flake8##########
0,1,I,I002:no configuration found (.isort.cfg or [isort] in configs)
1,1,D,D100:Missing docstring in public module
##########Linting Output - pylint##########
No config file found, using default configuration

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2913 [C:\Users\info_000\.vscode\extensions\fknop.vscode-npm-3.3.0]: Command `npm-script.start` appears multiple times in the `commands` section.
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2913 [C:\Users\info_000\.vscode\extensions\fknop.vscode-npm-3.3.0]: Command `npm-script.test` appears multiple times in the `commands` section.
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:3385 Overwriting grammar scope name to file mapping for scope source.python.
Old grammar file: e:\Program Files\Microsoft VS Code\resources\app\extensions\python\syntaxes\MagicPython.tmLanguage.json.
New grammar file: C:\Users\info_000\.vscode\extensions\magicstack.magicpython-1.0.12\grammars\MagicPython.tmLanguage
e.register @ /E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:3385
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:3385 Overwriting grammar scope name to file mapping for scope source.js.
Old grammar file: e:\Program Files\Microsoft VS Code\resources\app\extensions\javascript\syntaxes\JavaScript.tmLanguage.json.
New grammar file: C:\Users\info_000\.vscode\extensions\ms-vscode.typescript-javascript-grammar-0.0.41\syntaxes\JavaScript.tmLanguage.json
e.register @ /E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:3385
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:3385 Overwriting grammar scope name to file mapping for scope source.ts.
Old grammar file: e:\Program Files\Microsoft VS Code\resources\app\extensions\typescript-basics\syntaxes\TypeScript.tmLanguage.json.
New grammar file: C:\Users\info_000\.vscode\extensions\ms-vscode.typescript-javascript-grammar-0.0.41\syntaxes\TypeScript.tmLanguage.json
e.register @ /E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:3385
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:3385 Overwriting grammar scope name to file mapping for scope source.tsx.
Old grammar file: e:\Program Files\Microsoft VS Code\resources\app\extensions\typescript-basics\syntaxes\TypeScriptReact.tmLanguage.json.
New grammar file: C:\Users\info_000\.vscode\extensions\ms-vscode.typescript-javascript-grammar-0.0.41\syntaxes\TypeScriptReact.tmLanguage.json
e.register @ /E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:3385
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:3385 Overwriting grammar scope name to file mapping for scope text.html.django.
Old grammar file: C:\Users\info_000\.vscode\extensions\bibhasdn.django-html-1.2.0\syntaxes\django-html.json.
New grammar file: C:\Users\info_000\.vscode\extensions\thebarkman.vscode-djaneiro-1.4.1\syntaxes\django-html.json
e.register @ /E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:3385
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2913 [C:\Users\info_000\.vscode\extensions\ms-vscode.csharp-1.15.2]: Unknown language in `contributes.csharp.language`. Provided value: csharp
w._logMessageInConsole @ /E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2913
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2913 [C:\Users\info_000\.vscode\extensions\thekalinga.bootstrap4-vscode-4.1.1]: Unknown language in `contributes.bootstrap4-vscode.language`. Provided value: blade
w._logMessageInConsole @ /E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2913
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2913 [C:\Users\info_000\.vscode\extensions\thekalinga.bootstrap4-vscode-4.1.1]: Unknown language in `contributes.bootstrap4-vscode.language`. Provided value: ejs
w._logMessageInConsole @ /E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2913
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2913 [C:\Users\info_000\.vscode\extensions\thekalinga.bootstrap4-vscode-4.1.1]: Unknown language in `contributes.bootstrap4-vscode.language`. Provided value: handlebars
w._logMessageInConsole @ /E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2913
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2913 [C:\Users\info_000\.vscode\extensions\thekalinga.bootstrap4-vscode-4.1.1]: Unknown language in `contributes.bootstrap4-vscode.language`. Provided value: latte
w._logMessageInConsole @ /E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2913
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2913 [C:\Users\info_000\.vscode\extensions\thekalinga.bootstrap4-vscode-4.1.1]: Unknown language in `contributes.bootstrap4-vscode.language`. Provided value: razor
w._logMessageInConsole @ /E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2913
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2913 [C:\Users\info_000\.vscode\extensions\thekalinga.bootstrap4-vscode-4.1.1]: Unknown language in `contributes.bootstrap4-vscode.language`. Provided value: tpl
w._logMessageInConsole @ /E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2913
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2913 [C:\Users\info_000\.vscode\extensions\thekalinga.bootstrap4-vscode-4.1.1]: Unknown language in `contributes.bootstrap4-vscode.language`. Provided value: twig
w._logMessageInConsole @ /E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2913
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2913 [C:\Users\info_000\.vscode\extensions\thekalinga.bootstrap4-vscode-4.1.1]: Unknown language in `contributes.bootstrap4-vscode.language`. Provided value: vue
w._logMessageInConsole @ /E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2913
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2913 [C:\Users\info_000\.vscode\extensions\xabikos.javascriptsnippets-1.6.0]: Unknown language in `contributes.JavaScriptSnippets.language`. Provided value: vue
w._logMessageInConsole @ /E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2913
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:263 [Extension Host] Congratulations, your extension "scope-bar" is now active!
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:263 [Extension Host] Congratulations, your extension "angular2-switcher" is now active!
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:263 [Extension Host] vscode-icons is active!
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:263 [Extension Host] Failed to connect to provider "Command failed: git config --local --get remote.origin.url\n\n"
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:263 [Extension Host] rejected promise not handled within 1 second
t.log @ /E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:263
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2915 [amos402.scope-bar]{ uri: [Getter],
  fileName: [Getter],
  isUntitled: [Getter],
  languageId: [Getter],
  version: [Getter],
  isClosed: [Getter] == { uri: [Getter],
  fileName: [Getter],
  isUntitled: [Getter],
  languageId: [Getter],
  version: [Getter],
  isClosed: [Getter]
e.$onExtensionRuntimeError @ /E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2915
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2915 AssertionError: { uri: [Getter],
  fileName: [Getter],
  isUntitled: [Getter],
  languageId: [Getter],
  version: [Getter],
  isClosed: [Getter] == { uri: [Getter],
  fileName: [Getter],
  isUntitled: [Getter],
  languageId: [Getter],
  version: [Getter],
  isClosed: [Getter]
    at ScopeFinder.getSymbols (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:165:16)
    at ScopeFinder.<anonymous> (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:170:38)
    at Generator.next (<anonymous>)
    at C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:7:71
    at Promise (<anonymous>)
    at __awaiter (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:3:12)
    at ScopeFinder.getScopeSymbols (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:169:16)
    at ScopeFinder.<anonymous> (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:190:38)
    at Generator.next (<anonymous>)
    at C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:7:71
    at Promise (<anonymous>)
    at __awaiter (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:3:12)
    at ScopeFinder.updateNode (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:179:16)
    at ScopeFinder.<anonymous> (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:202:24)
    at Generator.next (<anonymous>)
    at C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:7:71
    at Promise (<anonymous>)
    at __awaiter (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:3:12)
    at ScopeFinder.getScopeNode (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:201:16)
    at ScopeSymbolProvider.<anonymous> (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:275:48)
    at Generator.next (<anonymous>)
    at C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:7:71
    at Promise (<anonymous>)
    at __awaiter (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:3:12)
    at Timeout.setTimeout [as _onTimeout] (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:262:31)
    at ontimeout (timers.js:390:18)
    at tryOnTimeout (timers.js:250:5)
    at Timer.listOnTimeout (timers.js:214:5)
e.$onExtensionRuntimeError @ /E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2915
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:263 [Extension Host] Failed to connect to provider "Command failed: git config --local --get remote.origin.url\n\n"
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:263 [Extension Host] rejected promise not handled within 1 second
t.log @ /E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:263
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2915 [amos402.scope-bar]{ uri: [Getter],
  fileName: [Getter],
  isUntitled: [Getter],
  languageId: [Getter],
  version: [Getter],
  isClosed: [Getter] == { uri: [Getter],
  fileName: [Getter],
  isUntitled: [Getter],
  languageId: [Getter],
  version: [Getter],
  isClosed: [Getter]
e.$onExtensionRuntimeError @ /E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2915
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2915 AssertionError: { uri: [Getter],
  fileName: [Getter],
  isUntitled: [Getter],
  languageId: [Getter],
  version: [Getter],
  isClosed: [Getter] == { uri: [Getter],
  fileName: [Getter],
  isUntitled: [Getter],
  languageId: [Getter],
  version: [Getter],
  isClosed: [Getter]
    at ScopeFinder.getSymbols (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:165:16)
    at ScopeFinder.<anonymous> (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:170:38)
    at Generator.next (<anonymous>)
    at C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:7:71
    at Promise (<anonymous>)
    at __awaiter (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:3:12)
    at ScopeFinder.getScopeSymbols (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:169:16)
    at ScopeFinder.<anonymous> (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:190:38)
    at Generator.next (<anonymous>)
    at C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:7:71
    at Promise (<anonymous>)
    at __awaiter (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:3:12)
    at ScopeFinder.updateNode (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:179:16)
    at ScopeFinder.<anonymous> (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:202:24)
    at Generator.next (<anonymous>)
    at C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:7:71
    at Promise (<anonymous>)
    at __awaiter (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:3:12)
    at ScopeFinder.getScopeNode (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:201:16)
    at ScopeSymbolProvider.<anonymous> (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:275:48)
    at Generator.next (<anonymous>)
    at C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:7:71
    at Promise (<anonymous>)
    at __awaiter (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:3:12)
    at Timeout.setTimeout [as _onTimeout] (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:262:31)
    at ontimeout (timers.js:390:18)
    at tryOnTimeout (timers.js:250:5)
    at Timer.listOnTimeout (timers.js:214:5)
e.$onExtensionRuntimeError @ /E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2915
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:263 [Extension Host] rejected promise not handled within 1 second
t.log @ /E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:263
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2915 [amos402.scope-bar]{ uri: [Getter],
  fileName: [Getter],
  isUntitled: [Getter],
  languageId: [Getter],
  version: [Getter],
  isClosed: [Getter] == { uri: [Getter],
  fileName: [Getter],
  isUntitled: [Getter],
  languageId: [Getter],
  version: [Getter],
  isClosed: [Getter]
e.$onExtensionRuntimeError @ /E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2915
/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2915 AssertionError: { uri: [Getter],
  fileName: [Getter],
  isUntitled: [Getter],
  languageId: [Getter],
  version: [Getter],
  isClosed: [Getter] == { uri: [Getter],
  fileName: [Getter],
  isUntitled: [Getter],
  languageId: [Getter],
  version: [Getter],
  isClosed: [Getter]
    at ScopeFinder.getSymbols (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:165:16)
    at ScopeFinder.<anonymous> (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:170:38)
    at Generator.next (<anonymous>)
    at C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:7:71
    at Promise (<anonymous>)
    at __awaiter (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:3:12)
    at ScopeFinder.getScopeSymbols (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:169:16)
    at ScopeFinder.<anonymous> (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:190:38)
    at Generator.next (<anonymous>)
    at C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:7:71
    at Promise (<anonymous>)
    at __awaiter (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:3:12)
    at ScopeFinder.updateNode (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:179:16)
    at ScopeFinder.<anonymous> (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:202:24)
    at Generator.next (<anonymous>)
    at C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:7:71
    at Promise (<anonymous>)
    at __awaiter (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:3:12)
    at ScopeFinder.getScopeNode (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:201:16)
    at ScopeSymbolProvider.<anonymous> (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:275:48)
    at Generator.next (<anonymous>)
    at C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:7:71
    at Promise (<anonymous>)
    at __awaiter (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:3:12)
    at Timeout.setTimeout [as _onTimeout] (C:\Users\info_000\.vscode\extensions\amos402.scope-bar-0.0.5\out\src\scope.js:262:31)
    at ontimeout (timers.js:390:18)
    at tryOnTimeout (timers.js:250:5)
    at Timer.listOnTimeout (timers.js:214:5)
e.$onExtensionRuntimeError @ /E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2915
9/E:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:263 [Extension Host] Failed to connect to provider "Command failed: git config --local --get remote.origin.url\n\n"
7console.ts:136 [Extension Host] Failed to connect to provider "Command failed: git config --local --get remote.origin.url\n\n"
DonJayamanne commented 6 years ago

Lol, looks like we'll need to reopen the VSCode issue as this is an upstream issue. I'll confirm this and reopen that issue, as the SET environment variables statement is generated by VSCode and not the Python extension.