Skip to content

Run selection/line in terminal fails with IPython #25915

@BlancaAlfaro

Description

@BlancaAlfaro

Type: Bug

Behaviour

Running selection/line with IPyhon activated does not execute on terminal. It starts a Python terminal but doesn't run the line.

(xxx) ➜  xxx ✗ /home/xxx/.cache/pypoetry/virtualenvs/xxxx/bin/python -m IPython --no-autoindent
Python 3.12.3 (main, Mar  3 2026, 12:15:18) [GCC 13.3.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 9.5.0 -- An enhanced Interactive Python. Type '?' for help.
Tip: You can use `%hist` to view history, see the options with `%history?`
Ctrl click to launch VS Code Native REPL

In [1]: 

Steps to reproduce:

  1. With IPython, open a .py file and either do Shift+Enter (if the shortcut is set to send to terminal) or right click /Run Python/Run selection/line in Python terminal
  2. Check that code isn't executed.

To compare without IPython
4. Disable IPython by commenting on the IPython part your settings file (Ctrl+Shift+P -> Preferences Open User Settings (JSON))

// "python.terminal.launchArgs": [
//     "-m",
//     "IPython",
//     "--no-autoindent"
// ],
  1. Kill previous terminal
  2. Open a .py file and either do Shift+Enter (if the shortcut is set to send to terminal) or right click /Run Python/Run selection/line in Python terminal.
  3. Check that code was sucessfully executed
(xxxx) ➜  xxxx ✗ /home/xxx/.cache/pypoetry/virtualenvs/xxxx/bin/python
Python 3.12.3 (main, Mar  3 2026, 12:15:18) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
Ctrl click to launch VS Code Native REPL
>>> import base64
>>> 

Diagnostic data

With IPython, Python output logs indicate :

2026-04-16 14:23:07.213 [info] > ~/.cache/pypoetry/virtualenvs/xxxx/bin/python ~/.vscode-server/extensions/ms-python.python-2026.2.0-linux-x64/python_files/normalizeSelection.py

Without, it has an extra line "Send text to terminal" :

2026-04-16 14:22:53.373 [info] > ~/.cache/pypoetry/virtualenvs/xxxx/bin/python ~/.vscode-server/extensions/ms-python.python-2026.2.0-linux-x64/python_files/normalizeSelection.py
2026-04-16 14:22:53.399 [info] Send text to terminal: import base64

Extension version: 2026.4.0
VS Code version: Code 1.116.0 (560a9dba96f961efea7b1612916f89e5d5d4d679, 2026-04-15T00:28:13Z)
OS version: Windows_NT x64 10.0.26200
Modes:
Remote OS version: Linux x64 6.6.87.2-microsoft-standard-WSL2

  • Python version (& distribution if applicable, e.g. Anaconda): 3.12.3.final.0
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Poetry
  • Value of the python.languageServer setting: Default
User Settings


languageServer: "Pylance"

testing
• unittestEnabled: true

terminal
• launchArgs: "<placeholder>"

Installed Extensions
Extension Name Extension Id Version
autodocstring njp 0.6.1
black-formatter ms- 2025.2.0
debugpy ms- 2025.18.0
flake8 ms- 2025.2.0
git-graph mhu 1.30.0
isort ms- 2025.0.0
js-debug ms- 1.112.0
jsts-chat-features Typ 0.0.2
jupyter ms- 2025.9.1
jupyter-renderers ms- 1.3.0
latex-workshop Jam 10.14.1
python ms- 2026.2.0
rainbow-csv mec 3.24.1
todo-tree Gru 0.0.226
vscode-github-actions git 0.31.3
vscode-js-profile-table ms- 1.0.10
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-slideshow ms- 0.1.6
vscode-ltex val 13.1.0
vscode-pull-request-github Git 0.136.0
vscode-pylance ms- 2026.2.1
vscode-python-envs ms- 1.28.0
System Info
Item Value
CPUs Intel(R) Core(TM) Ultra 9 185H (22 x 3072)
GPU Status 2d_canvas: enabled
GPU0: VENDOR= 0x8086, DEVICE=0x7d55 [Intel(R) Arc(TM) Graphics], DRIVER_VENDOR=Intel, DRIVER_VERSION=32.0.101.6881 ACTIVE
GPU1: VENDOR= 0x10de, DEVICE=0x2820 [NVIDIA GeForce RTX 4070 Laptop GPU], DRIVER_VERSION=32.0.15.8195
GPU2: VENDOR= 0x8086, DEVICE=0x7d55 [Intel(R) Arc(TM) Graphics], DRIVER_VERSION=32.0.101.6881
GPU3: VENDOR= 0x1414, DEVICE=0x008c [Microsoft Basic Render Driver], DRIVER_VERSION=10.0.26100.8246
Machine model name:
Machine model version:
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
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 31.46GB (15.73GB free)
Process Argv --crash-reporter-id ba975da8-c8c8-4cb1-a32f-64ceb93e275b
Screen Reader no
VM 0%
Item Value
Remote WSL: Ubuntu
OS Linux x64 6.6.87.2-microsoft-standard-WSL2
CPUs Intel(R) Core(TM) Ultra 9 185H (22 x 0)
Memory (System) 15.35GB (12.73GB free)
VM 0%
A/B Experiments
vsliv368:30146709
pythonvspyt551cf:31249601
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
82j33506:31327384
6abeh943:31336334
envsdeactivate2:31464701
cloudbuttont:31379625
3efgi100_wstrepl:31403338
use-responses-api:31390855
ec5jj548:31422691
cp_cls_c_966_ss:31454199
4je02754:31466945
c3h7c220:31478652
cp_cls_c_1081:31454833
conptydll_false:31489735
e9c30283:31461165
test_treatment2:31471001
idci7584:31464702
e3e4d672:31494082
534a6447_copy:31478748
chat:31457767
cpptoolsoff-v2:31475362
signintitlebar:31487064
ghj88844:31492074
23c7c724:31491644
client_tst_t:31495907
ddid_t:31478206
getcmakediagnosticsoff:31489825
cp_cls_c_1082:31491634
logging_enabled_new:31493367

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage-neededNeeds assignment to the proper sub-team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions