Repository navigation
First Run in Terminal sometimes doesn't start python REPL or wait for it to finish starting #22691
Description
Activity
- addedtriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
on Dec 23, 2023 Thank you for submitting the issue starball (@starball5) 👍🤝
Just for reference, here's where I asked about this issue on stackoverflow:
This issue occurs consistently on my system so if you have any questions or want me to try something, feel free to let me know.
Thanks!
Hello starball (@starball5), thanks for filing the issue. We are aware of this issue, and I will be looking closely into why this is happening. This is actually first time non-windows users filed issue with this first execution being swallowed up, but I will look in further see why it is happening and try to think of the solution.
- addedinfo-neededIssue requires more information from posterIssue requires more information from poster
on Jan 3, 2024 - addedbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugand removedinfo-neededIssue requires more information from posterIssue requires more information from poster
on Jan 3, 2024 Anthony Kim (@anthonykim1) to be clear, is this labelled "info-needed" because you are waiting on me to provide further info? If so, what do I need to do?
starball (@starball5) I think the bot automatically added it, but nothing needed from you at this point. It is currently not labelled with info-needed.
Reacted by starballHello starball (@starball5)
Good News for you: I have just merged in a PR to reduce the risk of the first command being ignored. It should be in the pre-release tomorrow if you would like to check it out!Reacted by starball- added a commit that references this issue
on Feb 17, 2024 - locked as resolved and limited conversation to collaborators
on Mar 18, 2024 - added 2 commits that reference this issue
on Mar 28, 2024
Behaviour
Expected vs. Actual
When no Python terminal created by the "Python: Run in Terminal" is currently open, running "Python: Run in Terminal" creates a new Terminal named "Python", and (tries to) start a Python interpreter to run the selected Python code in.
I expect the Python interpreter to finish starting up, and the first selected / smart-sent line to be given to the Python interpreter.
Instead, sometimes the first selected / smart-sent line becomes appended to the command that's supposed to start up the Python interpreter, resulting in an invalid command sent to the system shell. Sometimes even the first selected / smart-sent line is passed alone to the system shell before the command to start the Python interpreter has been run, and then the command to start the Python interpreter is run immediately afterward.
Steps to reproduce:
I cannot reproduce this reliably. Sometimes it starts up just fine, and sometimes I observe one of the two wrong behaviours.
I've tried using different combinations of the
terminal.integrated.shellIntegration.enabled,python.terminal.activateEnvInCurrentTerminal, andpython.terminal.activateEnvironmentsettings, but they don't seem to make a difference.I'm on VS Code 1.85.1 on Ubuntu 22.04.2. I have v2023.23.13541005 of this Python extension installed.
Diagnostic data
python.languageServersetting: PylanceOutput for
Pythonin theOutputpanel (View→Output, change the drop-down the upper-right of theOutputpanel toPython)Which looks fine, but my shell receives
/bin/python3a=1, gives an error message for it, then receivesb=2andc=3. It's not supposed to receive any of that (it's supposed to go to the Python interpreter, which failed to start due to the bad command).User Settings