microsoft / vscode-python

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

Gitbash #23381

Closed dmurphyinsaas closed 4 months ago

dmurphyinsaas commented 4 months ago

Type: Bug

Behaviour

When I open a Gitbash terminal window, rather than the path being set to current workspace directory as before, it is being set to some C:/Users/myuser/AppData/Local/Programs/Microsoft VS Code path and it appears some venv is active.

Steps to reproduce:

  1. Create new Folder and open this folder in VS code
  2. Open Gitbash terminal window (Opens to workspace folder as expected)
  3. Create venv python -m venv venv
  4. Create a python file touch main.py
  5. Open this file from VS Code file explorer.
  6. Terminal name turns yellow and on hover there is link to relaunch, click this relaunch terminal link.
  7. Terminal relaunches, this time some venv is activated and the path is set to C:/Users/myuser/AppData/Local/Programs/Microsoft VS Code

Diagnostic data

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

``` 2024-05-08 11:58:29.486 [info] Experiment 'pythonaacf' is active 2024-05-08 11:58:29.486 [info] Experiment 'pythonCreateEnvOnPipInstall' is active 2024-05-08 11:58:29.486 [info] Experiment 'pythonRecommendTensorboardExt' is active 2024-05-08 11:58:29.486 [info] Experiment 'pythonREPLSmartSend' is active 2024-05-08 11:58:29.486 [info] Experiment 'pythonTerminalEnvVarActivation' is active 2024-05-08 11:58:29.486 [info] Experiment 'pythonTestAdapter' is active 2024-05-08 11:58:29.486 [info] Default formatter is set to null for workspace c:\Temp\TestVS3 2024-05-08 11:58:29.486 [info] > hatch env show --json 2024-05-08 11:58:29.486 [info] cwd: . 2024-05-08 11:58:29.486 [info] Python interpreter path: ~\.pyenv\pyenv-win\versions\3.11.3\python.exe 2024-05-08 11:58:29.533 [info] > conda info --json 2024-05-08 11:58:29.567 [info] > ~\.pyenv\pyenv-win\versions\3.11.3\python.exe -I ~\.vscode\extensions\ms-python.python-2024.7.11291009\python_files\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2024.7.11291009\python_files\interpreterInfo.py 2024-05-08 11:58:29.601 [info] > .\venv\Scripts\python.exe -I ~\.vscode\extensions\ms-python.python-2024.7.11291009\python_files\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2024.7.11291009\python_files\interpreterInfo.py 2024-05-08 11:58:29.788 [info] > ~\.pyenv\pyenv-win\bin\pyenv which python 2024-05-08 11:58:29.788 [info] cwd: . 2024-05-08 11:58:30.316 [info] > . ./venv/Scripts/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2024.7.11291009/python_files/printEnvVariables.py 2024-05-08 11:58:30.316 [info] shell: bash 2024-05-08 11:58:30.498 [info] > ~\.pyenv\pyenv-win\versions\3.10.11\python.exe ~/.vscode/extensions/ms-python.python-2024.7.11291009/python_files/printEnvVariables.py 2024-05-08 11:58:30.498 [info] shell: bash 2024-05-08 11:58:30.591 [info] Setting environment variable MSYS in collection to disable_pcon disable_pcon {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-05-08 11:58:30.591 [info] Prepending environment variable PATH in collection with c:\Users\asus\.vscode\extensions\ms-python.python-2024.7.11291009\python_files\deactivate\bash;C;C:\Temp\TestVS3\venv\Scripts;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\asus\bin; {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-05-08 11:58:30.591 [info] Prepending environment variable PS1 in collection with (venv) {"applyAtShellIntegration":true,"applyAtProcessCreation":false} 2024-05-08 11:58:30.591 [info] Setting environment variable PWD in collection to C:/Users/asus/AppData/Local/Programs/Microsoft VS Code {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-05-08 11:58:30.591 [info] Setting environment variable PYTHONIOENCODING in collection to utf-8 {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-05-08 11:58:30.591 [info] Setting environment variable PYTHONUNBUFFERED in collection to 1 {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-05-08 11:58:30.591 [info] Setting environment variable VIRTUAL_ENV in collection to C:\Temp\TestVS3\venv {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-05-08 11:58:30.591 [info] Setting environment variable VIRTUAL_ENV_PROMPT in collection to (venv) {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-05-08 11:58:30.592 [info] Send text to terminal: C:/Users/asus/.pyenv/pyenv-win/versions/3.10.11/python.exe c:\Users\asus\.vscode\extensions\ms-python.python-2024.7.11291009\python_files\printEnvVariablesToFile.py c:\Users\asus\.vscode\extensions\ms-python.python-2024.7.11291009\python_files\deactivate\bash\envVars.txt 2024-05-08 11:58:31.789 [info] Starting Pylance language server. 2024-05-08 11:58:31.941 [info] Python interpreter path: c:\Temp\TestVS3\venv\Scripts\python.exe 2024-05-08 11:59:00.599 [error] Failed to initialize deactivate script C:\Program Files\Git\bin\bash.exe Error: "c:\Users\asus\.vscode\extensions\ms-python.python-2024.7.11291009\python_files\deactivate\bash\envVars.txt" file not created at Timeout. (c:\Users\asus\.vscode\extensions\ms-python.python-2024.7.11291009\out\client\extension.js:2:273765) at listOnTimeout (node:internal/timers:569:17) at processTimers (node:internal/timers:512:7) ```

Extension version: 2024.7.11281013 VS Code version: Code 1.89.0 (b58957e67ee1e712cebf466b995adf4c5307b2bd, 2024-05-01T02:09:22.859Z) OS version: Windows_NT x64 10.0.22631 Modes:

User Settings

``` languageServer: "Pylance" ```

Installed Extensions |Extension Name|Extension Id|Version| |---|---|---| |.NET Install Tool|ms-dotnettools.vscode-dotnet-runtime|2.0.5| |C#|ms-dotnettools.csharp|2.28.11| |ChatGPT - Genie AI|genieai.chatgpt-vscode|0.0.10| |Code Spell Checker|streetsidesoftware.code-spell-checker|3.0.1| |Dev Containers|ms-vscode-remote.remote-containers|0.362.0| |Docker|ms-azuretools.vscode-docker|1.29.1| |DotENV|mikestead.dotenv|1.0.1| |Draw.io Integration|hediet.vscode-drawio|1.6.6| |Git History|donjayamanne.githistory|0.6.20| |GitHub Actions|github.vscode-github-actions|0.26.2| |GitHub Copilot|GitHub.copilot|1.187.0| |GitHub Copilot Chat|GitHub.copilot-chat|0.15.0| |GitHub Pull Requests|GitHub.vscode-pull-request-github|0.88.0| |GitLens — Git supercharged|eamodio.gitlens|14.9.1| |IntelliCode|VisualStudioExptTeam.vscodeintellicode|1.3.1| |IntelliCode API Usage Examples|VisualStudioExptTeam.intellicode-api-usage-examples|0.2.8| |JavaScript Debugger|ms-vscode.js-debug|1.89.0| |JavaScript Debugger Companion Extension|ms-vscode.js-debug-companion|1.1.2| |Jupyter|ms-toolsai.jupyter|2024.4.0| |Jupyter Cell Tags|ms-toolsai.vscode-jupyter-cell-tags|0.1.9| |Jupyter Keymap|ms-toolsai.jupyter-keymap|1.1.2| |Jupyter Notebook Renderers|ms-toolsai.jupyter-renderers|1.0.17| |Jupyter Slide Show|ms-toolsai.vscode-jupyter-slideshow|0.1.6| |Mocha sidebar|maty.vscode-mocha-sidebar|0.22.2| |Pylance|ms-python.vscode-pylance|2024.5.1| |Python|ms-python.python|2024.7.11281013| |Python Debugger|ms-python.debugpy|2024.6.0| |Rainbow CSV|mechatroner.rainbow-csv|3.11.0| |Swagger Viewer|Arjun.swagger-viewer|3.1.2| |Table Visualizer for JavaScript Profiles|ms-vscode.vscode-js-profile-table|1.0.9| |Test Adapter Converter|ms-vscode.test-adapter-converter|0.1.9| |Test Explorer UI|hbenl.vscode-test-explorer|2.21.1| |vscode-pdf|tomoki1207.pdf|1.2.2| |WSL|ms-vscode-remote.remote-wsl|0.88.2| |YAML|redhat.vscode-yaml|1.14.0|
System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 5 5500U with Radeon Graphics (12 x 2096)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|15.38GB (3.78GB free)| |Process Argv|--folder-uri file:///c%3A/Users/asus/Documents/github/insaas/insaas-notebooks-experiments --crash-reporter-id a9eaff0c-8dbb-48f1-a524-0a5dc444f644| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492:30256859 vstes627:30244334 vscoreces:30445986 vscod805cf:30301675 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30959799 pythongtdpath:30769146 welcomedialog:30910333 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 h48ei257:31000450 pythontbext0:30879054 accentitlementsc:30995553 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 chatpanelt:31018789 dsvsc021:30996838 01bff139:31013167 pythoncenvptcf:31039767 dwnewjupyter:31039675 ```
dmurphyinsaas commented 4 months ago

wrong system info, will reopen