Skip to content
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

Pressing "run python file in terminal" doesn't work #5916

Closed
Meru opened this issue Jun 5, 2019 · 19 comments
Closed

Pressing "run python file in terminal" doesn't work #5916

Meru opened this issue Jun 5, 2019 · 19 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug regression Bug didn't exist in a previous release

Comments

@Meru
Copy link

Meru commented Jun 5, 2019

Pressing "run python file in terminal" doesn't work since the update. Worked fine with older version of the python extension.
Verified on a clean vscode profile with just one vscode-python

Environment data

  • VS Code version: 1.34.0
  • Extension version (available under the Extensions sidebar): 2019.5.18426
  • OS and version: win7 SP1 x64
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.3 x64
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
  • Relevant/affected Python packages and their versions: N/A

Expected behavior

file that is being edited is being executed in terminal

Actual behavior

nothing happens

Steps to reproduce:

  1. make a one-line python file: print("sdfsdgfb")
  2. press "run python file in terminal"
@Meru Meru added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Jun 5, 2019
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Jun 5, 2019
@DonJayamanne DonJayamanne added P0 regression Bug didn't exist in a previous release labels Jun 5, 2019
@DonJayamanne DonJayamanne added this to the 2019 - May Sprint 11 milestone Jun 5, 2019
@luabud
Copy link
Member

luabud commented Jun 5, 2019

image

@DonJayamanne DonJayamanne self-assigned this Jun 5, 2019
@DonJayamanne
Copy link

DonJayamanne commented Jun 5, 2019

@Meru
Please could you check your user settings.json and workspace settings.json for the existence of a setting for terminal.integrated.shell.*.
I believe you may have changed the shell to use command prompt instead of powershell.

Note: This isn't a user error, its a bug at our end and I'm trying to identify the exact cause so we can fix this issue ASAP and release a fix.

  • Also, please could you provide some screenshots of the terminal
  • And any errors logged in the console widows (go to Help->Toggle Developer Tools)

@gateslm
Copy link

gateslm commented Jun 5, 2019

This issue is currently happening when the user settings.json has the following :

"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"

When opening the Toggle Developer Tools, I get the message below (multiple times but the same message)

Toggle Developer Tools: Console

The following occurs when I click on the file in Visual Studio Code and select Run Python File in Terminal (File path names removed)

Example run of terminal with Python code

Python Extension Version: 2019.5.18426
Visual Studio Code Version: 1.34.0 (system setup)

@ibakirov
Copy link

ibakirov commented Jun 5, 2019

Same error for me, simple print("Hello") does not work
No terminal.integrated.shell.windows" in settings.json

Winver: 1903 (18362.145)

Version: 1.35.0 (user setup)
Commit: 553cfb2c2205db5f15f3ee8395bbd5cf066d357d
Date: 2019-06-04T01:17:12.481Z
Electron: 3.1.8
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 10.0.18362

VS Code Python extension: 2019.5.18426 (4 June 2019)

Python: 3.7.3 64-bit
pip: 19.1.1
virtualenv: 16.6.0

@DonJayamanne
Copy link

DonJayamanne commented Jun 5, 2019

@ibakirov
What's your default shell command prompt or powershell?
Also, please could you let me know what happens when you select the menu Run python file in terminal.
Is the terminal opened and if so what happens.
Finally, please could you send a screenshot of the terminal and selecting the command.

Please could you check your user settings.json.

@DonJayamanne
Copy link

Hi everyone, we're sorry about this bug. We hope to have a fix out ASAP.
@gateslm Your issue should be resolve in the fix.
@ibakirov & @Meru please could you reply back to the question, that'll help us address the issues you are having as well.

@ibakirov
Copy link

ibakirov commented Jun 5, 2019

@DonJayamanne default shell is Powershell. Here is the screenshot after I run the menu:

изображение

@ibakirov
Copy link

ibakirov commented Jun 5, 2019

settings.json:

изображение

@ibakirov
Copy link

ibakirov commented Jun 5, 2019

Developer Tools:

изображение

@luabud
Copy link
Member

luabud commented Jun 5, 2019

Hi @ibakirov, thanks for providing more info.

The .vscode/settings.json is the workspace settings. Would you mind opening the user settings.json by opening the Command Palette (View > Command Palette...) and looking for "Preferences: Open Settings (JSON)"? Sorry about that, we just want to make sure we understand what's going on.

@ibakirov
Copy link

ibakirov commented Jun 5, 2019

@luabud yes, of course.. I have never touched shell settings both in workspace and user settings:

изображение

@ErickMurage
Copy link

Mine has started working after changing the default shell to PowerShell. The terminal looks awfully different though, and I don't know if that's good.
screenshot

@lukehuxham
Copy link

I am having the same issue since upgrading to v1.35.0. From context menu "run python file in terminal" has no effect, Nothing is logged in the console of the developer tools either. I have the setting "terminal.integrated.shell.windows": "C:\windows\System32\cmd.exe" set in my user settings (see below).

image

I can use ctrl + ' to spawn new cmd prompt which opens to the correct directory and automatically executes to the correct conda env as it used to, I can then simple type python filename.py and runs as expected. Hope this information helps fix, I do use this feature a lot as part of my workflow

@bonakdarf92
Copy link

wait until the fix of @DonJayamanne is done (PR Validation) ... we all are waiting for a fix 👍

@DonJayamanne
Copy link

DonJayamanne commented Jun 5, 2019

Will fix pushing a release shortly. Apologies for the inconvenience caused

@ibakirov
Copy link

ibakirov commented Jun 6, 2019

I confirm VS Code Python extension: 2019.5.18678 (5 June 2019) resolves this issue and Run Python File in Terminal command works fine!

@estebanaranza
Copy link

hola, pues a mi me aparece esto "Cannot read property 'comspec' of undefined" cuando ejecuto la terminal de python, estoy aprendiendo a programar, soy principiante, no se que significa y no he encontrado como solucionarlo. agradezco su ayuda.
WhatsApp Image 2019-06-06 at 10 19 25 AM

@luabud
Copy link
Member

luabud commented Jun 6, 2019

hola @estebanaranza. Puede abrir un nuevo issue que ofrezca más detalles sobre este error, cómo los pasos para reproducirlo? Aquí: https://github.com/microsoft/vscode-python/issues/new?template=bug_report.md
Gracias!

@estebanaranza
Copy link

hola, cordial saludo, no se que paso, pero ya volvió a funcionar la terminal de python, no le hice nada, solo que la extension de python en visual studio code, me pidio reiniciar y funciono, no se que le hicieron, entiendo poco de esto, apenas estoy aprendiendo, pero gracias por solucionarlo!!!

@lock lock bot locked as resolved and limited conversation to collaborators Jun 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug regression Bug didn't exist in a previous release
Projects
None yet
Development

No branches or pull requests

9 participants