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

Python: Create Terminal Doesn't Use Activate.ps1 in Powershell #6928

Closed
rafaci opened this issue Aug 11, 2019 · 10 comments

Comments

@rafaci
Copy link

commented Aug 11, 2019

Environment data

  • VS Code version: 1.37
  • Extension version (available under the Extensions sidebar): 2019.8.29288
  • OS and version: Windows 10 1903
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.7.3 64-bit
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
  • Relevant/affected Python packages and their versions: N/A
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info #3977): Jedi

Expected behaviour

Running the Python: Create Terminal command should properly activate my terminal using Activate.ps1

I expect to see this

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

Loading personal and system profiles took 1881ms.
D:\MyProject [master ≡ +1 ~7 -0 !]> d:/MyProject/venv/Scripts/Activate.ps1
D:\MyProject [master ≡ +1 ~7 -0 !]>

Actual behaviour

The command activates my terminal with activate.bat

This is what I see

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

Loading personal and system profiles took 1881ms.
D:\MyProject [master ≡ +1 ~7 -0 !]> d:/MyProject/venv/Scripts/activate.bat
D:\MyProject [master ≡ +1 ~7 -0 !]>

Steps to reproduce:

  1. Run the Python: Create Terminal command.
@PhilMacKay

This comment has been minimized.

Copy link

commented Aug 12, 2019

Hi! I confirm I have the same issue, but with small differences in the environment:
Environment data

  • VS Code version: 1.36.1
  • Extension version (available under the Extensions sidebar): 2019.8.29288
  • OS and version: Windows 10 Pro 1903
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.7.3 64-bit
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
  • Relevant/affected Python packages and their versions: N/A
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info #3977): affects both

It affects Powershell Core 6 as well as Powershell. One possible workaround is to switch default shell to cmd, but I prefer the flexibility of Powershell.
The other option is to stay on version 2019.6.24221, which is not affected by this bug.

@DonJayamanne

This comment has been minimized.

Copy link

commented Aug 12, 2019

@rafaci @PhilMacKay

  • How did you create your virtual environment?
  • Please could you open the developer tools window (Help-> Toggle Developer Tools)
    • Go back to VS Code
    • Open a Python file
    • GO back to developer tools window
    • Go to the Console tab
    • Clear everything out (there's a Clear Console icon on the top left)
    • Go back to VS Code
    • Select the command Python: Create Terminal
    • Go to the developer tools window and into the Console tab
    • Copy everything from the console output window
    • Paste it into this issue.

The information helps us identify the type of the shell being detected by the extension.

@PhilMacKay

This comment has been minimized.

Copy link

commented Aug 12, 2019

@DonJayamanne

I created the environment with this line inside a batch script:
py -3.7-64 -m venv --clear --copies ..\\envMyProject

By following your instructions, I have the following output. Seems like the core of the problem comes from the following: [Error: [ms-python.python]: Proposed API is only available when running out of dev or with the following command line switch: --enable-proposed-api ms-python.python

console.ts:134 [Extension Host] Info Python Extension: 2019-08-12 17:16:18: [object Object]. Shell identified as undefined 
console.ts:134 [Extension Host] Error Python Extension: 2019-08-12 17:16:18: Unable to determine shell using VS Code API. [Error: [ms-python.python]: Proposed API is only available when running out of dev or with the following command line switch: --enable-proposed-api ms-python.python	at a (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:472:367)	at Object.t.checkProposedApiEnabled (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:473:343)	at Object.get shell [as shell] (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:726:799)	at p.get shell [as shell] (C:\Users\PhilMacKay\.vscode\extensions\ms-python.python-2019.8.29288\out\client\extension.js:75:305726)	at u.identify (C:\Users\PhilMacKay\.vscode\extensions\ms-python.python-2019.8.29288\out\client\extension.js:75:445660)	at p.identifyTerminalShell (C:\Users\PhilMacKay\.vscode\extensions\ms-python.python-2019.8.29288\out\client\extension.js:75:440845)	at m.identifyTerminalShell (C:\Users\PhilMacKay\.vscode\extensions\ms-python.python-2019.8.29288\out\client\extension.js:75:437149)	at f.ensureTerminal (C:\Users\PhilMacKay\.vscode\extensions\ms-python.python-2019.8.29288\out\client\extension.js:75:435275)	at f.show (C:\Users\PhilMacKay\.vscode\extensions\ms-python.python-2019.8.29288\out\client\extension.js:75:435149)	at l.onCreateTerminal (C:\Users\PhilMacKay\.vscode\extensions\ms-python.python-2019.8.29288\out\client\extension.js:75:898642)	at l.module.exports.t.captureTelemetry.o.value (C:\Users\PhilMacKay\.vscode\extensions\ms-python.python-2019.8.29288\out\client\extension.js:1:8867)	at f._executeContributedCommand (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:503:621)	at f.$executeContributedCommand (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:504:6)	at d._doInvokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:653:1006)	at d._invokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:653:698)	at d._receiveRequest (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:652:346)	at d._receiveOneMessage (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:651:141)	at define.constructor._protocol.onMessage.e (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:649:400)	at u.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:48:468)	at a (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:177:627)	at e (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:177:673)	at u.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:48:468)	at n.constructor.e.onMessage.e (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:758:621)	at u.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:48:468)	at a (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:177:627)	at e (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:177:673)	at u.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:48:468)	at y._receiveMessage (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:186:545)	at define.constructor._socketDisposables.push._socketReader.onMessage.e (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:183:860)	at u.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:48:468)	at f.acceptChunk (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:180:393)	at define.constructor._register._socket.onData.e (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:179:731)	at Socket.t (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:188:22)	at Socket.emit (events.js:182:13)	at addChunk (_stream_readable.js:283:12)	at readableAddChunk (_stream_readable.js:264:11)	at Socket.Readable.push (_stream_readable.js:219:10)	at Pipe.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)]
t.log @ console.ts:134
$logExtensionHostMessage @ mainThreadConsole.ts:38
_doInvokeHandler @ rpcProtocol.ts:394
_invokeHandler @ rpcProtocol.ts:379
_receiveRequest @ rpcProtocol.ts:299
_receiveOneMessage @ rpcProtocol.ts:226
_protocol.onMessage.e @ rpcProtocol.ts:101
fire @ event.ts:558
a @ ipc.net.ts:421
e @ ipc.net.ts:428
fire @ event.ts:558
_receiveMessage @ ipc.net.ts:715
S._socketDisposables.push._socketReader.onMessage.e @ ipc.net.ts:578
fire @ event.ts:558
acceptChunk @ ipc.net.ts:236
_register._socket.onData.e @ ipc.net.ts:197
t @ ipc.net.ts:28
emit @ events.js:182
addChunk @ _stream_readable.js:283
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onStreamRead @ internal/stream_base_commons.js:94
console.ts:134 [Extension Host] Info Python Extension: 2019-08-12 17:16:18: [object Object]. Shell identified as undefined 
console.ts:134 [Extension Host] Info Python Extension: 2019-08-12 17:16:18: Shell path 'C:\Program Files\PowerShell\6\pwsh.exe'
console.ts:134 [Extension Host] Info Python Extension: 2019-08-12 17:16:18: Shell path identified as shell 'powershellCore'
console.ts:134 [Extension Host] Info Python Extension: 2019-08-12 17:16:18: Shell path from user settings 'C:\Program Files\PowerShell\6\pwsh.exe'
console.ts:134 [Extension Host] Info Python Extension: 2019-08-12 17:16:18: [object Object]. Shell identified as powershellCore 
console.ts:134 [Extension Host] Info Python Extension: 2019-08-12 17:16:18: Shell identified as 'powershellCore'
c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\xterm\lib\xterm.js:1 [Violation] Added non-passive event listener to a scroll-blocking 'wheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
t.addDisposableDomListener @ c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\xterm\lib\xterm.js:1
t.bindMouse @ c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\xterm\lib\xterm.js:1
t.open @ c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\xterm\lib\xterm.js:1
e.open @ c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\xterm\lib\xterm.js:1
_xtermReadyPromise.then @ terminalInstance.ts:548
_tickCallback @ internal/process/next_tick.js:68
c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\xterm\lib\xterm.js:1 [Violation] Added non-passive event listener to a scroll-blocking 'wheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
t.addDisposableDomListener @ c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\xterm\lib\xterm.js:1
t.bindMouse @ c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\xterm\lib\xterm.js:1
t.open @ c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\xterm\lib\xterm.js:1
e.open @ c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\xterm\lib\xterm.js:1
_xtermReadyPromise.then @ terminalInstance.ts:548
_tickCallback @ internal/process/next_tick.js:68
c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\xterm\lib\xterm.js:1 [Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
t.addDisposableDomListener @ c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\xterm\lib\xterm.js:1
t.bindMouse @ c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\xterm\lib\xterm.js:1
t.open @ c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\xterm\lib\xterm.js:1
e.open @ c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\xterm\lib\xterm.js:1
_xtermReadyPromise.then @ terminalInstance.ts:548
_tickCallback @ internal/process/next_tick.js:68
c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\xterm\lib\xterm.js:1 [Violation] Added non-passive event listener to a scroll-blocking 'touchmove' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
t.addDisposableDomListener @ c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\xterm\lib\xterm.js:1
t.bindMouse @ c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\xterm\lib\xterm.js:1
t.open @ c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\xterm\lib\xterm.js:1
e.open @ c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\xterm\lib\xterm.js:1
_xtermReadyPromise.then @ terminalInstance.ts:548
_tickCallback @ internal/process/next_tick.js:68
console.ts:134 [Extension Host] Info Python Extension: 2019-08-12 17:16:18: Shell path 'Python'
console.ts:134 [Extension Host] Info Python Extension: 2019-08-12 17:16:18: Shell path identified as shell 'other'
console.ts:134 [Extension Host] Info Python Extension: 2019-08-12 17:16:18: Terminal name 'Python' identified as shell 'other'
console.ts:134 [Extension Host] Info Python Extension: 2019-08-12 17:16:18: [object Object]. Shell identified as other (Terminal name is Python)
console.ts:134 [Extension Host] Info Python Extension: 2019-08-12 17:16:18: Shell identified as 'other'
console.ts:134 [Extension Host] Info Python Extension: 2019-08-12 17:16:18: Using default OS shell
2console.ts:134 [Extension Host] Info Python Extension: 2019-08-12 17:16:18: Cached data exists getEnvironmentVariables, c:\Sources\MyProject

Notice, however, that when using the command Terminal: Create New Integrated Terminal, the virtual environment is correctly activated using the .ps1 script.

@rafaci

This comment has been minimized.

Copy link
Author

commented Aug 15, 2019

Here's the output I get for version 2019.8.30787 (broken)

console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:23:42: [object Object]. Shell identified as undefined 
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:23:42: Shell path 'C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:23:42: Shell path identified as shell 'powershell'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:23:42: Terminal shell path 'C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe' identified as shell 'powershell'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:23:42: [object Object]. Shell identified as powershell 
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:23:42: Shell identified as 'powershell'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:23:42: Shell path 'Python'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:23:42: Shell path identified as shell 'other'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:23:42: Terminal name 'Python' identified as shell 'other'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:23:42: [object Object]. Shell identified as other (Terminal name is Python)
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:23:42: Shell identified as 'other'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:23:42: Using default OS shell
2console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:23:42: Cached data exists getEnvironmentVariables, d:\VSCodeSandbox\test.py
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:23:42: Shell path 'Python'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:23:42: Shell path identified as shell 'other'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:23:42: Terminal name 'Python' identified as shell 'other'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:23:42: [object Object]. Shell identified as other (Terminal name is Python)
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:23:42: Shell identified as 'other'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:23:42: Using default OS shell
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:23:42: Shell path 'Python'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:23:42: Shell path identified as shell 'other'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:23:42: Terminal name 'Python' identified as shell 'other'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:23:42: [object Object]. Shell identified as other (Terminal name is Python)
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:23:42: Shell identified as 'other'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:23:42: Using default OS shell

Here's the output I get with version 2019.6.24221 (working)

[Extension Host] Info Python Extension: 2019-08-15 13:25:46: Shell path from user settings 'null'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Shell path 'C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Shell path identified as shell 'powershell'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Shell path from user env 'C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Shell identified as 'powershell'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Terminal name 'Python' identified as shell 'other'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Shell path from user settings 'null'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Shell path 'C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Shell path identified as shell 'powershell'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Shell path from user env 'C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Shell identified as 'powershell'
2console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Cached data exists getEnvironmentVariables, d:\VSCodeSandbox\test.py
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Terminal name 'Python' identified as shell 'other'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Shell path from user settings 'null'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Shell path 'C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Shell path identified as shell 'powershell'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Shell path from user env 'C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Shell identified as 'powershell'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Cached data exists getEnvironmentVariables, d:\VSCodeSandbox\test.py
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Terminal name 'Python' identified as shell 'other'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Shell path from user settings 'null'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Shell path 'C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Shell path identified as shell 'powershell'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Shell path from user env 'C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Shell identified as 'powershell'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Cached data exists getEnvironmentVariables, d:\VSCodeSandbox
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Cached data exists getEnvironmentVariables, d:\VSCodeSandbox\test.py
console.ts:137 [Extension Host] Info Python Extension: 2019-08-15 13:25:46: Cached data exists getEnvironmentVariables, d:\VSCodeSandbox
@Marsfan

This comment has been minimized.

Copy link

commented Aug 16, 2019

Just want to add to this I have been having the same issue.

Perhaps the best way to fix this would be to call venv/Scripts/activate as opposed to activate.ps1 or activate.bat, as this file will be present irregardless of what terminal is being used to activate the venv, and always works (in my experience) I have looked at the source for this extension as I have considered changing this myself, but I do not know typescript, and cannot figure out how I would do this myself.

@DonJayamanne

This comment has been minimized.

Copy link

commented Aug 16, 2019

@PhilMacKay Please could you try upgrading your version of VS Code to the latest version (1.37)

@PhilMacKay

This comment has been minimized.

Copy link

commented Aug 19, 2019

Gladly! Here is the log using

  • VSCode version 1.37.1
  • Python extension version 2019.8.30787
  • Python version 3.7.3 x64
  • Windows 10 Pro version 1903
  • Using venv for virtual environment
  • Using Powershell: "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe":
[Extension Host] Info Python Extension: 2019-08-19 18:27:57: [object Object]. Shell identified as undefined 
console.ts:137 [Extension Host] Info Python Extension: 2019-08-19 18:27:57: Shell path 'C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-19 18:27:57: Shell path identified as shell 'powershell'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-19 18:27:57: Terminal shell path 'C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe' identified as shell 'powershell'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-19 18:27:57: [object Object]. Shell identified as powershell 
console.ts:137 [Extension Host] Info Python Extension: 2019-08-19 18:27:57: Shell identified as 'powershell'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-19 18:27:57: Shell path 'Python'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-19 18:27:57: Shell path identified as shell 'other'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-19 18:27:57: Terminal name 'Python' identified as shell 'other'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-19 18:27:57: [object Object]. Shell identified as other (Terminal name is Python)
console.ts:137 [Extension Host] Info Python Extension: 2019-08-19 18:27:57: Shell identified as 'other'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-19 18:27:57: Using default OS shell
2console.ts:137 [Extension Host] Info Python Extension: 2019-08-19 18:27:57: Cached data exists getEnvironmentVariables, c:\sources\MyProject    

Same thing but with PowerShell Core 6 ("terminal.integrated.shell.windows": "C:\\Program Files\\PowerShell\\6\\pwsh.exe")

[Extension Host] Info Python Extension: 2019-08-19 18:36:55: [object Object]. Shell identified as undefined 
console.ts:137 [Extension Host] Info Python Extension: 2019-08-19 18:36:55: Shell path 'C:\Program Files\PowerShell\6\pwsh.exe'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-19 18:36:55: Shell path identified as shell 'powershellCore'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-19 18:36:55: Terminal shell path 'C:\Program Files\PowerShell\6\pwsh.exe' identified as shell 'powershellCore'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-19 18:36:55: [object Object]. Shell identified as powershellCore 
console.ts:137 [Extension Host] Info Python Extension: 2019-08-19 18:36:55: Shell identified as 'powershellCore'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-19 18:36:55: Shell path 'Python'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-19 18:36:55: Shell path identified as shell 'other'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-19 18:36:55: Terminal name 'Python' identified as shell 'other'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-19 18:36:55: [object Object]. Shell identified as other (Terminal name is Python)
console.ts:137 [Extension Host] Info Python Extension: 2019-08-19 18:36:55: Shell identified as 'other'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-19 18:36:55: Using default OS shell
2console.ts:137 [Extension Host] Info Python Extension: 2019-08-19 18:36:55: Cached data exists getEnvironmentVariables, c:\sources\MyProject
@silverches

This comment has been minimized.

Copy link

commented Aug 20, 2019

I seem to be having the same issue

Environment data

  • VS Code version: 1.37.1
  • Extension version (available under the Extensions sidebar): 2019.8.30787
  • OS and version: Windows 10 Pro 10.0.18362 Build 18362
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.7.2 32 bit
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
[Extension Host] Info Python Extension: 2019-08-20 13:30:23: [object Object]. Shell identified as undefined 
console.ts:137 [Extension Host] Info Python Extension: 2019-08-20 13:30:23: Shell path 'C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-20 13:30:23: Shell path identified as shell 'powershell'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-20 13:30:23: Terminal shell path 'C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe' identified as shell 'powershell'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-20 13:30:23: [object Object]. Shell identified as powershell 
console.ts:137 [Extension Host] Info Python Extension: 2019-08-20 13:30:23: Shell identified as 'powershell'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-20 13:30:23: Shell path 'Python'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-20 13:30:23: Shell path identified as shell 'other'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-20 13:30:23: Terminal name 'Python' identified as shell 'other'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-20 13:30:23: [object Object]. Shell identified as other (Terminal name is Python)
console.ts:137 [Extension Host] Info Python Extension: 2019-08-20 13:30:23: Shell identified as 'other'
console.ts:137 [Extension Host] Info Python Extension: 2019-08-20 13:30:23: Using default OS shell
2console.ts:137 [Extension Host] Info Python Extension: 2019-08-20 13:30:23: Cached data exists getEnvironmentVariables, c:\Users\rick\Documents\Online authoring\webapp\models\entity.py
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.   

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\rick\Documents\Online authoring> "c:/Users/rick/Documents/Online authoring/venv/Scripts/activate.bat"
c:/Users/rick/Documents/Online authoring/venv/Scripts/activate.bat
PS C:\Users\rick\Documents\Online authoring> 
@PhilMacKay

This comment has been minimized.

Copy link

commented Sep 3, 2019

Hello! I did some digging tonight with the code pulled from github.
The issue seems to be related to the shellDetector that works based on the name of the terminal. If it doesn't have a match, it returns the value "other", which is then considered a success on line 57 of the same file.

By changing the test condition from if (shell) { to if (shell && shell !== 'other') {, the detection is considered failed and the next detectors can be used. It leads to a correct detection of the shell type, therefore the correct "activate" script is used.

I don't know if the test condition in the identifyTerminalShell needs to be modified, or if it's the shell detector itself that should return undefined instead of the value "other"...

Anyways, I hope this helps! I would make a pull request but my modification actually breaks two unit tests:
Interpreters Known Paths
Ensure known list of paths are returned on non-windows
Ensure PATH variable and known list of paths are merged on non-windows

Thanks for the help!

@karrtikr

This comment has been minimized.

Copy link

commented Sep 18, 2019

validated

@karrtikr karrtikr closed this Sep 18, 2019
@pvscbot pvscbot removed the needs PR label Sep 18, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Sep 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.