-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KeyboardInterrupt When Running Selection/Line in Python Terminal with 'Shift+Enter' #24422
Comments
Yes, no issue with v2024.14.1. Thanks. |
I was experiencing the same issue and can confirm that rolling back to previous versions gets rid of it. |
Thanks @levibaguley! I had the same issue and this fixed. |
Phew. Same issue and this worked. Thanks! |
Hi. Thank you all for your contributions. However, even specifying in "Preferences: Open Workplace Settings (JSON)" the setting "python.REPL.sendToNativeREPL" to false, the KeyboardInterrupt still shows up. I don't know if it is related to the issue, but even if I still turn it to false in "Preferences: Open Workplace Settings (JSON)", in the page "Preferences: Open Default Settings (JSON)" (which I cannot edit), the setting "python.REPL.sendToNativeREPL" is still set true. |
Issue remains in v2024.18.0. |
Rolling Back did fix the issue and as @kcerniauskas3 said ; it still remains in v2024.18.0. |
Thanks everyone for the input here. |
Yes, Windows 10 for me |
I see, can folks also give 2024.16.1 a try and see whether it also adds the keyboard interrupt or not? Edit: After restarting extension, and reloading with Python clear cache, I can repro this on 16.1 too 'Python: Clear Cache and Reload' via command palette (cmd/ctrl + shift + p) |
Thanks for this @rodo-nunez This is incredibly helpful! |
Using binary search: v2024.15.2024091801 failed So my guess is that the bug was introduced on v2024.15.2024091301. |
@anthonykim1 also, I was reproducing that using the "Python: Run Selection/Line in Python Terminal" command. I always change it to Ctrl+Enter, to be able to freely choose between "Python: Run Selection/Line in Python Terminal" and "Python: Run Selection/Line in Python REPL" whenever I want. On v2024.15.2024091301, I don't see problems with the REPL, only with the Terminal. But I don't use the REPL that much. |
Ok, thanks to @rodo-nunez I was able to figure out where this is coming from quickly. Its from this PR: https://github.com/microsoft/vscode-python/pull/24078/files For now, the workaround to not get this keyboard interrupt would be going to setting and then disabling shell integration: And Yes! the REPL you mentioned in the editor is our new native REPL. It has intellisense and syntax highlighting, autocomplete so feel free to give it a try :) |
@anthonykim1 I upgraded to Follow-up: After having made these changes, I noticed a modest amount of latency in sending the code to the Python terminal via Shift + Enter and getting executed. I have reverted to |
I'm using version 2024.18.0 and I used the prerelease version, but unfortunately for every line of code I run through the script, I have this issue update: i add this line to my jason settings (workspace jason settings): |
I still see KeyboardInterrupt with a Python 3.11.9 venv on Windows and with
I do not see it when |
do you have shell integration enabled in upper shell? |
Further fix is on the way for folks using windows in regards to preventing keyboard interrupt #24542 |
I guess it needs a new Python extensions. |
@anthonykim1 I will reopen this. Please close again when ready for verification. |
My fault. Was not on latest insiders. |
Further resolves: #24422 Prevent keyboard interrupt for Mac and Linux when using Python3.13 Having Python3.13 as interpreter choice and then enabling shell integration where it is normally supported (we disabled temporarily for Python3.13 due to python/cpython#126131), lead to edge case. So although we don't override user's PS1 in Python side after checking Python3.13 is selected, we were not aware of this in typescript side, leading to wrongly using executeCommand inside Python terminal REPL (Python3.13 IDLE), instead of sendText.
Environment:
Operating System: Windows 11
VS Code Version: 1.94.0
Python Extension Version: v2024.16.0
Steps to reproduce:
Default setting: the 'shift+enter' keyboard shortcut Runs Selection/Line in Python REPL.
Expected Behavior:
The selected line or code executes in the Python Terminal without any interruptions or errors.
Actual Behavior:
A KeyboardInterrupt is outputted before the selection or line continues executing in the Python Terminal.
Additional Information:
Screen.Recording.2024-10-04.211253.mp4
Screen.Recording.2024-10-04.211730.mp4
The text was updated successfully, but these errors were encountered: