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.

Truncated venv activation script on pwsh

See original GitHub issue

Issue Type: Bug

Behaviour

Expected vs. Actual

Expected to launch a new integrated terminal instance with pwsh and have the venv activation script run.

Actual: It attempts to run sers/ehawman/Documents/Programming/Python/PA-FindReplace/.venv/Scripts/Activate.ps1 and fails.

Note that on Nushell, it attempts the full & c:/Users/.../activate.ps1 just fine. (it just isn’t the right script)

Steps to reproduce:

  1. Launch a new integrated terminal instance with PowerShell with a venv Python Interpreter selected.

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.10.5
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
  • Value of the python.languageServer setting: Pylance
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

Experiment 'pythonaacf' is active
Experiment 'pythonTensorboardExperiment' is active
Experiment 'pythonSurveyNotification' is active
Experiment 'PythonPyTorchProfiler' is active
LSP Notebooks experiment is disabled -- not in treatment group
> conda info --json
Python interpreter path: .\.venv\Scripts\python.exe
> "C:\Program Files\Python310\python.exe" ~\.vscode\extensions\ms-python.python-2022.8.0\pythonFiles\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2022.8.0\pythonFiles\interpreterInfo.py
> "C:\Program Files\Python\Python310\python.exe" ~\.vscode\extensions\ms-python.python-2022.8.0\pythonFiles\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2022.8.0\pythonFiles\interpreterInfo.py
> ./.venv/Scripts/activate.bat && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2022.8.0/pythonFiles/printEnvVariables.py
> .\.venv\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2022.8.0\pythonFiles\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2022.8.0\pythonFiles\interpreterInfo.py
Starting Pylance language server.
DAP Server launched with command: c:\Users\ehawman\Documents\Programming\Python\PA-FindReplace\.venv\Scripts\python.exe c:\Users\ehawman\.vscode\extensions\ms-python.python-2022.8.0\pythonFiles\lib\python\debugpy\adapter

User Settings


languageServer: "Pylance"

formatting
• provider: "black"

Extension version: 2022.8.0 VS Code version: Code 1.68.1 (30d9c6cd9483b2cc586687151bcbcd635f373630, 2022-06-14T12:48:58.283Z) OS version: Windows_NT x64 10.0.19044 Restricted Mode: No

System Info
Item Value
CPUs Intel® Core™ i7-10750H CPU @ 2.60GHz (12 x 2592)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.64GB (2.85GB free)
Process Argv –crash-reporter-id af5d9697-6537-4cfb-a29a-4989d2b727f9
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonvspyt551:30345470
pythonptprofiler:30281270
vsdfh931cf:30280410
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
vscscmwlcmt:30465135
cppdebug:30492333
vsclangdc:30486549
c4g48928:30516488

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
ehawman-rosenbergcommented, Jul 7, 2022

Ah drat. Sorry. I’ll do it when I get to work tomorrow.

0reactions
karrtikrcommented, Jul 29, 2022

The command we send to the terminal using VSCode API is:

& c:/Users/ehawman/Documents/Programming/Python/PA-FindReplace/.venv/Scripts/Activate.ps1

which seems to be the correct one, however the screenshot in terminal says a different command: image

Looks like VSCode strips some text off, could you open this issue at https://github.com/microsoft/vscode? Closing as this is not caused by the extension.

It maybe due to the color themes the VSCode integrated powershell terminal is using, try clearing it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add support of Nushell · Issue #19359 · microsoft/vscode-python
Weirdly, when actually using pwsh it truncates the activation command: sers/ehawman/Documents/Programming/Python/PA-FindReplace/.venv/Scripts/ ...
Read more >
'virtualenv' won't activate on Windows - Stack Overflow
This would allow running virtualenv in the current PowerShell session. ... To activate virtualenv on Windows, activate script is in the Scripts folder:...
Read more >
PowerShell prompt doesn't show virtualenv : PY-22469
There's a workaround for this issue. Under Settings > Tools > Terminal you can uncheck the Activate virtualenv option and then set the...
Read more >
Configuration - Starship: Cross-Shell Prompt
The directory module shows the path to your current directory, truncated to three parent folders. Your directory will also be truncated to the...
Read more >
WHY DID I STOP USING THE COMMAND LINE TO ACTIVATE ...
Now, start the Command prompt/PowerShell window in the project directory by right-clicking on the project directory while pressing Shift key. OR ...
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