Cannot copy from output of interactive window
pe224 opened this issue · 1 comments
Applies To
- Notebooks (.ipynb files)
- Interactive Window and/or Cell Scripts (.py files with #%% markers)
What happened?
Steps:
- open new empty VSCode window (empty
Untitled-1
editor is open) - command
Jupyter: Create new interactive window
- run command
print("hello")
in interactive window - select string
hello
in interactive window output and press Ctrl+C
- press Ctrl+V in
Untitled-1
editor or in the interactive window cell (or anywhere else)
I would expect that string hello
is pasted, but instead, whatever was in clipboard before is inserted.
Remarks
- clicking on the three dots next to the output cell and selecting
Copy Cell Output
works, but this is not a good workaround, since it copies the whole cell, not only the selection - similar issues been reported before #767, #844, but despite being (presumably) fixed, it doesn't work for me
VS Code Version
Version: 1.93.1 Commit: 38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40 Date: 2024-09-11T17:20:05.685Z Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Code/1.93.1 Chrome/124.0.6367.243 Electron/30.4.0 Safari/537.36
Jupyter Extension Version
v2024.8.1
Jupyter logs
Visual Studio Code (1.93.1, undefined, desktop)
Jupyter Extension Version: 2024.8.1.
Python Extension Version: 2024.14.1.
Pylance Extension Version: 2024.9.2.
Platform: win32 (x64).
Temp Storage folder ~\AppData\Roaming\Code\User\globalStorage\ms-toolsai.jupyter\version-2024.8.1
No workspace folder opened.
17:29:07.096 [info] Telemetry level is off
17:29:07.096 [info] Experiments are disabled, only manually opted experiments are active.
17:29:07.431 [info] Starting interactive window for resource '' with controller '.jvsc74a57bd0e093919099ee72d3eee808a92cec0b0b451cc3c52ba30e5eda7e9d95c64efc31.c:\Users\~\AppData\Local\Programs\Python\Python312\python.exe.c:\Users\~\AppData\Local\Programs\Python\Python312\python.exe.-m#ipykernel_launcher (Interactive)'
17:29:07.622 [info] Starting Kernel (Python Path: ~\AppData\Local\Programs\Python\Python312\python.exe, Unknown, 3.12.3) for 'Interactive-1.interactive' (disableUI=false)
17:29:08.201 [warn] Failed to get activated env vars for ~\AppData\Local\Programs\Python\Python312\python.exe in 632ms
17:29:08.246 [info] Process Execution: ~\AppData\Local\Programs\Python\Python312\python.exe -c "import site;print("USER_BASE_VALUE");print(site.USER_SITE);print("USER_BASE_VALUE");"
17:29:08.317 [warn] Failed to get activated env vars for ~\AppData\Local\Programs\Python\Python312\python.exe in 679ms
17:29:08.585 [info] Process Execution: ~\AppData\Local\Programs\Python\Python312\python.exe -m pip list
17:29:08.658 [info] Process Execution: ~\AppData\Local\Programs\Python\Python312\python.exe -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
17:29:08.698 [info] Process Execution: ~\AppData\Local\Programs\Python\Python312\python.exe c:\Users\~\.vscode\extensions\ms-toolsai.jupyter-2024.8.1-win32-x64\pythonFiles\vscode_datascience_helpers\kernel_interrupt_daemon.py --ppid 38408
> cwd: ~\.vscode\extensions\ms-toolsai.jupyter-2024.8.1-win32-x64\pythonFiles\vscode_datascience_helpers
17:29:08.893 [warn] Stderr output when getting ipykernel version & path Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'ipykernel' for ~\AppData\Local\Programs\Python\Python312\python.exe
17:29:09.430 [info] Process Execution: ~\AppData\Local\Programs\Python\Python312\python.exe -m ipykernel_launcher --f=c:\Users\~\AppData\Roaming\jupyter\runtime\kernel-v3c6983c6f357646a4a3af09edc152f181ea0a9cc5.json
> cwd: ~\AppData\Local\Programs\Microsoft VS Code
17:29:09.751 [error] Disposing kernel process due to an error Error: The kernel died. Error: ... View Jupyter [log](command:jupyter.viewOutput) for further details.
> Kernel Id = .jvsc74a57bd0e093919099ee72d3eee808a92cec0b0b451cc3c52ba30e5eda7e9d95c64efc31.c:\Users\~\AppData\Local\Programs\Python\Python312\python.exe.c:\Users\~\AppData\Local\Programs\Python\Python312\python.exe.-m#ipykernel_launcher
> Interpreter Id = c:\USERS\~\APPDATA\LOCAL\PROGRAMS\PYTHON\PYTHON312\PYTHON.EXE
> at ChildProcess.<anonymous> (c:\Users\~\.vscode\extensions\ms-toolsai.jupyter-2024.8.1-win32-x64\dist\extension.node.js:299:44598)
> stdErr =
17:29:09.751 [error]
17:29:09.754 [error] Failed to connect raw kernel session: Error: The kernel died. Error: ... View Jupyter [log](command:jupyter.viewOutput) for further details.
17:29:09.754 [error] Failed to connect raw kernel session: Error: The kernel died. Error: ... View Jupyter [log](command:jupyter.viewOutput) for further details.
17:29:09.754 [warn] Failed to shutdown kernel, .jvsc74a57bd0e093919099ee72d3eee808a92cec0b0b451cc3c52ba30e5eda7e9d95c64efc31.c:\Users\~\AppData\Local\Programs\Python\Python312\python.exe.c:\Users\~\AppData\Local\Programs\Python\Python312\python.exe.-m#ipykernel_launcher [TypeError: Cannot read properties of undefined (reading 'dispose')
at L_.shutdown (c:\Users\~\.vscode\extensions\ms-toolsai.jupyter-2024.8.1-win32-x64\dist\extension.node.js:304:13629)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async U_.shutdown (c:\Users\~\.vscode\extensions\ms-toolsai.jupyter-2024.8.1-win32-x64\dist\extension.node.js:304:22107)]
17:29:09.755 [warn] Error occurred while trying to start the kernel, options.disableUI=false Error: The kernel died. Error: ... View Jupyter [log](command:jupyter.viewOutput) for further details.
> Kernel Id = .jvsc74a57bd0e093919099ee72d3eee808a92cec0b0b451cc3c52ba30e5eda7e9d95c64efc31.c:\Users\~\AppData\Local\Programs\Python\Python312\python.exe.c:\Users\~\AppData\Local\Programs\Python\Python312\python.exe.-m#ipykernel_launcher
> Interpreter Id = c:\USERS\~\APPDATA\LOCAL\PROGRAMS\PYTHON\PYTHON312\PYTHON.EXE
> at ChildProcess.<anonymous> (c:\Users\~\.vscode\extensions\ms-toolsai.jupyter-2024.8.1-win32-x64\dist\extension.node.js:299:44598)
> stdErr =
17:29:09.756 [warn] Kernel Error, context = start Error: The kernel died. Error: ... View Jupyter [log](command:jupyter.viewOutput) for further details.
> Kernel Id = .jvsc74a57bd0e093919099ee72d3eee808a92cec0b0b451cc3c52ba30e5eda7e9d95c64efc31.c:\Users\~\AppData\Local\Programs\Python\Python312\python.exe.c:\Users\~\AppData\Local\Programs\Python\Python312\python.exe.-m#ipykernel_launcher
> Interpreter Id = c:\USERS\~\APPDATA\LOCAL\PROGRAMS\PYTHON\PYTHON312\PYTHON.EXE
> at ChildProcess.<anonymous> (c:\Users\~\.vscode\extensions\ms-toolsai.jupyter-2024.8.1-win32-x64\dist\extension.node.js:299:44598)
> stdErr =
17:29:09.772 [warn] Failed to get activated env vars for ~\AppData\Local\Programs\Python\Python312\python.exe in 11ms
17:29:09.813 [info] Process Execution: ~\AppData\Local\Programs\Python\Python312\python.exe -c "import ipykernel;print('6af208d0-cb9c-427f-b937-ff563e17efdf')"
17:29:10.042 [info] Check & install missing Kernel dependencies for ~\AppData\Local\Programs\Python\Python312\python.exe, ui.disabled=false for resource 'Interactive-1.interactive'
17:29:10.084 [info] Process Execution: ~\AppData\Local\Programs\Python\Python312\python.exe -c "import ipykernel;print('6af208d0-cb9c-427f-b937-ff563e17efdf')"
17:29:10.480 [info] Process Execution: ~\AppData\Local\Programs\Python\Python312\python.exe -c "import pip;print('6af208d0-cb9c-427f-b937-ff563e17efdf')"
17:29:11.748 [info] Dispose Kernel 'Interactive-1.interactive' associated with 'Interactive-1.interactive'
17:29:15.894 [warn] No interpreter with path C:\Users\~\projects\.venv-global\Scripts\python.exe found in Python API, will convert Uri path to string as Id C:\Users\~\projects\.venv-global\Scripts\python.exe
17:29:15.896 [warn] The following kernels use interpreters that are no longer valid or not recognized by Python extension, Kernels startUsingPythonInterpreter:'id=.jvsc74a57bd02a8dfe095fce2b5e88c64a2c3ee084c8e0e0d70b23e7b95b1cfb538be294c5c8.c:\msys64\mingw64\bin\python.exe.c:\msys64\mingw64\bin\python.exe.-m#ipykernel_launcher'(interpreterId='c:\MSYS64\MINGW64\BIN\PYTHON.EXE'),startUsingPythonInterpreter:'id=.jvsc74a57bd003f586cabbde0e1d287f04763d906d0b7d6a1a4fb8f82bea7dcc6bd39bdb0788.c:\msys64\mingw64\bin\python3.11.exe.c:\msys64\mingw64\bin\python3.11.exe.-m#ipykernel_launcher'(interpreterId='c:\MSYS64\MINGW64\BIN\PYTHON3.11.EXE') and valid interpreter ids include C:\USERS\~\APPDATA\LOCAL\PROGRAMS\PYTHON\PYTHON312\PYTHON.EXE, C:\USERS\~\APPDATA\LOCAL\PROGRAMS\PYTHON\PYTHON311\PYTHON.EXE, C:\USERS\~\APPDATA\LOCAL\PROGRAMS\PYTHON\PYTHON310\PYTHON.EXE, C:\MSYS64\MINGW64\BIN\PYTHON3.EXE, C:\USERS\~\PROJECTS\.VENV-GLOBAL\SCRIPTS\PYTHON.EXE
17:29:15.904 [info] Starting Kernel (Python Path: ~\projects\.venv-global\Scripts\python.exe, VirtualEnv, 3.12.3) for 'Interactive-1.interactive' (disableUI=false)
17:29:16.466 [info] Process Execution: ~\projects\.venv-global\Scripts\python.exe -m pip list
17:29:16.495 [info] Process Execution: ~\projects\.venv-global\Scripts\python.exe -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
17:29:16.510 [info] Process Execution: ~\projects\.venv-global\Scripts\python.exe -m ipykernel_launcher --f=c:\Users\~\AppData\Roaming\jupyter\runtime\kernel-v360926b43d2160989b5cb942921ff2bed4c9bf18c.json
> cwd: ~\AppData\Local\Programs\Microsoft VS Code
17:29:19.493 [info] Kernel successfully started
17:29:19.503 [info] Process Execution: ~\projects\.venv-global\Scripts\python.exe c:\Users\~\.vscode\extensions\ms-toolsai.jupyter-2024.8.1-win32-x64\pythonFiles\printJupyterDataDir.py
Coding Language and Runtime Version
Python v3.12.3
Language Extension Version (if applicable)
No response
Anaconda Version (if applicable)
No response
Running Jupyter locally or remotely?
Local
Update:
It actually works fine on my coworkers PC.
First thing I tried was to manually disable all extensions besides jupyter
. This did not help.
However, when firing up a fresh, portable version of VSCode and installing only the jupyter
extension, it actually works!
After some digging, I found that I had set the following shortcut
{
"key": "ctrl+c",
"command": "list.clear",
"when": "listFocus && listHasSelectionOrFocus && !editorTextFocus",
},
Commenting this out, the copying works fine.
So it seems that inside the interactive window, listFocus && listHasSelectionOrFocus
is true
.