问题描述
我使用 Visual Studio Code 来调试 Python 脚本.
遵循
但是当我按下 Debug 时,它说我的参数不被识别,Visual Studio Code 说:
错误:无法识别的参数
由于 Visual Studio Code 使用 PowerShell,让我们使用相同的参数执行相同的文件:
所以:相同的文件、相同的路径和相同的参数.它在终端中工作,但在 Visual Studio Code 中不工作.
我哪里错了?
我认为 --City 和 Auckland 被用作单个参数.也许尝试像这样将它们分开...
单参数
"args": ["--city","Auckland"]
多个参数和多个值
例如:
--key1 value1 value2 --key2 value3 value4
只需将它们一一放入args
列表依次:
args":[--key1"、value1"、value2"、--key2"、value3"、value4"]
I'm using Visual Studio Code in order to debug a Python script.
Following this guide, I set up the argument in the launch.json
file:
But when I press on Debug, it says that my argument is not recognized and Visual Studio Code says:
As Visual Studio Code is using PowerShell, let's execute the same file with the same argument:
So: the same file, same path, and same argument. In the terminal it is working, but not in Visual Studio Code.
Where am I wrong?
I think the --City and Auckland are used as a single argument. Maybe try separating them like so...
Single argument
"args": ["--city","Auckland"]
Multiple arguments and multiple values
Such as:
--key1 value1 value2 --key2 value3 value4
Just put them into the args
list one by one in sequence:
"args": ["--key1", "value1", "value2", "--key2", "value3", "value4"]
这篇关于Visual Studio Code:如何使用参数调试 Python 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!