Skip to content

redirect input on debug #141

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions