Skip to content

redirect input on debug #141

@axiqia

Description

@axiqia

I'd love to have something like this http://stackoverflow.com/questions/32863807/visual-studio-code-redirect-input-on-debug without a workaround. That is, ability to redirect input from a given file, when debugging.

I have tried to add arg option in launch.json,

    "configurations": [
        {
            "name": "Python: Debug",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "args": ["<",
                "input.txt"
            ]
        }
    ]

but the launch command doesn't work as usual. The terminal hangs and after I type enter, I got a exception.

Exception has occurred: ValueError
invalid literal for int() with base 10: '

The python script:

n = int(input())
print(n)

The input.txt content:
5

Is there any suggestion?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions