You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
First Run in Terminal sometimes doesn't start python REPL or wait for it to finish starting #22691
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, and python.terminal.activateEnvironment settings, 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 version (& distribution if applicable, e.g. Anaconda): 3.10.12
Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Global
Value of the python.languageServer setting: Pylance
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
2023-12-22 22:14:01.084 [info] Send text to terminal: /bin/python3
2023-12-22 22:14:01.969 [info] Send text to terminal: a=1
b=2
c=3
Which looks fine, but my shell receives /bin/python3a=1, gives an error message for it, then receives b=2 and c=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
languageServer: "Pylance"
testing
• unittestArgs: "<placeholder>"
• unittestEnabled: true
terminal
• activateEnvironment: true (also happens when set to false)
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.
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.
Hello 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!
Activity
dharmatech commentedon Dec 23, 2023
Thank you for submitting the issue starball (@starball5) 👍🤝
dharmatech commentedon Dec 23, 2023
Just for reference, here's where I asked about this issue on stackoverflow:
https://stackoverflow.com/questions/77702135/f8-the-first-time-evaluates-line-in-powershell-not-in-python
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!
anthonykim1 commentedon Jan 3, 2024
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.
starball5 commentedon Jan 4, 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?
anthonykim1 commentedon Jan 4, 2024
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.
anthonykim1 commentedon Feb 16, 2024
Hello 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!
Prevent first Python command being lost (microsoft#22902)
Merged PR posit-dev/positron-python#395: Merge upstream: `v2024.2.0`
Merged PR posit-dev/positron-python#395: Merge upstream: `v2024.2.0`