Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS code run selection in interactive window doesn't work

I have VS code 1.56 where I'm trying to run both python and julia. I have some problems running selected python code in the interactive windows. When I press the keybindings (shift + enter) I don't get any action. I tried to "toggle keyboards shortcuts troubleshooting" and I get the following log

[2021-05-11 14:08:54.305] [renderer1] [info] [KeybindingService]: \ From 13 keybinding entries, matched jupyter.execSelectionInteractive, when: editorTextFocus && jupyter.ownsSelection && !findInputFocussed && !notebookEditorFocused && !replaceInputFocussed && editorLangId == 'python', source: user extension ms-toolsai.jupyter.
[2021-05-11 14:08:54.308] [renderer1] [error] spawn python ENOENT: Error: spawn python ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
    at onErrorNT (internal/child_process.js:465:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)

I read here to flag "Jupyter: Send Selection To Interactive Window" but still doesn't work.

Do you have any suggestions?

like image 944
Luca Monno Avatar asked Feb 01 '26 21:02

Luca Monno


2 Answers

I know this thread is old but I have had the same problem for ages. It was not a conflicting keybinding but rather that, for a reason I have not tried to track down, the when condition was not being satisfied.

In my case, I was able to solve the problem by changing the when condition in the Keyboard Shortcuts and removing the "&& jupyter.ownsSelection" block. This restored full functionality.

I previously removed the keybinding for executing code fragment in the terminal, which conflicted.

like image 58
user3684418 Avatar answered Feb 04 '26 16:02

user3684418


None of the above worked for me. I finally made it work by:

  1. Going to settings
  2. Searching "jupyter send"
  3. Tick on the option "Jupyter > Interactive Window > Text Editor: Execute Selection

And yes, it works with .py files. And you need to have the # %% cells enter image description here

like image 38
Fjord Avatar answered Feb 04 '26 15:02

Fjord



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!