Skip to content

python (terminal) fails to run #10985

Closed
Closed

Description

@memoakten

Issue Type: Bug

Summary:
If I launch vscode from the terminal within a folder, I can run the project. But if I open folder from within vscode, it fails to run (It just seems to get stuck trying to run).

Steps to reproduce:

  1. open folder containing python project (any project, can be a single file containing print("hello world")
  2. Run. Doesn't work.
  3. close code and launch from terminal: code .
  4. Run. Works

Code:
test.py:
print("hello world")

.vscode/launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal"
        }
    ]
}

Opening from terminal and running:
vscode_python_terminal

Opening folder and running (stuck like this):
vscode_python_openfolder

Extension version: 2020.3.71659
VS Code version: Code 1.43.2 (0ba0ca52957102ca3527cf479571617f0de6ed50, 2020-03-24T07:52:11.516Z)
OS version: Linux x64 5.3.0-45-generic snap

System Info
Item Value
CPUs Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 4000)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: disabled_software
skia_renderer: disabled_off_ok
video_decode: unavailable_off
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled
Load (avg) 1, 1, 1
Memory (System) 15.54GB (0.33GB free)
Process Argv . --no-sandbox
Screen Reader no
VM 0%

Activity

  1. ghost added
    triage-needed
    on Apr 6, 2020
  2. ghost removed
    triage-needed
    on Apr 6, 2020
  3. added
    triage-needed
    bug
    and removed
    triage-needed
    on Apr 6, 2020
  4. int19h commented on Apr 7, 2020

    @int19h

    Can you clarify what command specifically you're using to run? Is it Run -> Start Debugging, Run -> Run Without Debugging, or are you using the "Run Python File in Terminal" toolbar button?

  5. memoakten commented on Apr 8, 2020

    @memoakten
    Author

    Hi, none of those methods work. I get the same results in each case.
    In fact I realised my issue is that terminal doesn't open in code if I run it from gnome (see the lower picture in my orig post, no terminal). However if I run it from the terminal, it does work. I don't even need to open the folder from terminal with 'code .'. I can just launch from any folder with 'code' , and then open folder from within vscode, and it still works.

    I've tried /bin/bash and /bin/sh as my default shell, and neither of them work when launching vscode from gnome. (See settings below).

    I had installed code via snap sudo snap install code --classic and no updates are available.

    ~/.config/Code/User/settings.json
    {
        "terminal.integrated.inheritEnv": false,
        "window.zoomLevel": 0,
        "explorer.confirmDelete": false,
        "[javascript]": {
            "editor.defaultFormatter": "HookyQR.beautify"
        },
        "[html]": {
            "editor.defaultFormatter": "vscode.html-language-features"
        },
        "python.dataScience.sendSelectionToInteractiveWindow": true,
        "[jsonc]": {
            "editor.defaultFormatter": "HookyQR.beautify"
        },
        "[json]": {
            "editor.defaultFormatter": "vscode.json-language-features"
        },
        "editor.minimap.enabled": true,
        "python.dataScience.askForKernelRestart": false,
        "terminal.integrated.shell.linux": "/bin/bash"
    }
    
  6. int19h commented on Apr 16, 2020

    @int19h

    To clarify, the terminal doesn't work at all? Not just specifically for debugging?

  7. memoakten commented on Apr 17, 2020

    @memoakten
    Author

    Yes, that was exactly the problem, the terminal wasn't launching at all (you can see no terminal in the image below). However, now the issue seems to be gone and terminal is working fine. At the time I posted the issue the latest vscode version was 1.43.2, now my vscode is 1.44.2. I'm not sure if it's related.

    image

  8. int19h commented on Apr 27, 2020

    @int19h

    I suspect that this has something to do with environment variables in a terminal session vs outside, perhaps affecting VSCode terminal functionality in general? Either way, glad to hear that it's fixed in a newer version!

  9. ghost removed on Apr 27, 2020
  10. locked as resolved and limited conversation to collaborators on May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions