-
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
Using play button after running selection in terminal use DOS syntax at Python ">>>" #11435
Comments
Good news and bad news. I went through another cycle of reinstalling Python extension and play button issue fixed again. |
As long as I know, the "play button" (Run Python File in Terminal), in this extension, runs the command
If you run this command inside a Python REPL, it will give you that error. And I also experienced that the the "play button" will create a terminal named "Python" before run the above command. If this terminal already exists, it will be used. So, if you have a terminal named "Python" running CMD, the above command will be ok. If you have a terminal named "Python" running python REPL, the above command will give you an error. |
Hey everyone. This is just to inform you that we can confirm the issue. |
Just to give another information: the logic I've posted before "If this terminal already exists, it will be used" is not always true. I had see it in another issue here in Github (sorry, can't find it to refer here) I tried to create a new CMD terminal and renamed it with "Python". But the "play button" created another terminal named "Python" anyway. (figure below) So (at least for my case), the logic that works is: Is it ok? |
Yes, that's expected. Thanks for helping others earlier! |
Hi all! Are there any updates on this thread? I've also run into the issue described, and though uninstalling and reinstalling the Python extension resolves it, the problem very quickly reemerges. |
It will be good if the the command "Run Python File on terminal" could recognizes that there is an already active opened Python terminal running. This would avoid this issue. As an alternative, the command triggered with the play button could run the At least it could let us customize this command, or hide the Play Button. |
Closing as dup of #2997. |
I have a vague recollection that in my case Python not running was related
to my closing a PowerShell session. Apparently, VS Code runs Python in
PowerShell and not the Windows/DOS CLI? Making sure I still had PowerShell
running seemed to solve the problem.
…On Mon, Dec 19, 2022, 7:59 AM Kartik Raj ***@***.***> wrote:
Closing as dup of #2997
<#2997>.
—
Reply to this email directly, view it on GitHub
<#11435 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB7QNKQW6HOP35ADMGBIFUDWOBLZ7ANCNFSM4MSCYL7Q>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Visual Studio Code Python Extension Play button seems to be using DOS syntax on Python command prompt ">>>".
Does not matter which command line is select in terminal (Python or Cmd)
===
I can highlight lines and run Python code
(from command pallet "Python: Run Selection/Line in Python Terminal").
===
But, when I try pressing the PLAY BUTTON I get message (note triple python prompt, but DOS/cmd syntax)
">>> C:/Users/JimCa/AppData/Local/Programs/Python/Python38/python.exe c:/Users/JimCa/Documents/campaign/CampaignFinance/hello.py
File "", line 1
C:/Users/JimCa/AppData/Local/Programs/Python/Python38/python.exe c:/Users/JimCa/Documents/campaign/CampaignFinance/hello.py
^
SyntaxError: invalid syntax"
===
The paths are correct (even though AppData is hidden)
===
"Run without debugging" from the Run menu works
===
From Help About:
Version: 1.44.2 (system setup)
Commit: ff915844119ce9485abfe8aa9076ec76b5300ddd
Date: 2020-04-16T16:36:23.138Z
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.18363
Environment data
"python.jediEnabled"
set to; more info How to update the language server to the latest stable version #3977): XXXpython.languageServer
setting: XXXExpected behaviour
Run hello.py
Actual behaviour
">>> C:/Users/JimCa/AppData/Local/Programs/Python/Python38/python.exe c:/Users/JimCa/Documents/campaign/CampaignFinance/hello.py
File "", line 1
C:/Users/JimCa/AppData/Local/Programs/Python/Python38/python.exe c:/Users/JimCa/Documents/campaign/CampaignFinance/hello.py
^
SyntaxError: invalid syntax"
Steps to reproduce:
[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]
from command palette -- codes runs OK
Python ">>>" prompt
Logs
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
) NONEOutput from
Console
under theDeveloper Tools
panel (toggle Developer Tools on underHelp
; turn on source maps to make any tracebacks be useful by runningEnable source map support for extension debugging
)The text was updated successfully, but these errors were encountered: