[Python] Visual Studio Code: How debug Python script with arguments

Discussão em 'Python' iniciado por Stack, Fevereiro 25, 2025.

  1. Stack

    Stack Membro Participativo

    I'm using Visual Studio Code with the inbuilt Debugger in order to debug a Python script.

    Following this guide, I set up the argument in the launch.json file:

    [​IMG]

    But when I press on Debug, it says that my argument is not recognized my shell, or rather the argparser, says:


    error: unrecognized arguments: --city Auckland
    ​

    [​IMG]

    As Visual Studio Code is using PowerShell, let's execute the same file with the same argument:

    [​IMG]

    So: the same file, same path, and same argument. In the terminal it is working, but not in Visual Studio Code's Debugger.

    Where am I wrong?

    Continue reading...

Compartilhe esta Página