簡體   English   中英

將對象作為字符串傳遞以在 VSCode 的 launch.json 文件中進行調試

[英]Pass object as a string for debugging in VSCode' launch.json file

我正在嘗試使用 VSCode 調試器調試我的 python 模塊。 我准備我的launch.json文件如下:

{
  "version": "0.2.0",
      "configurations": [
          {
              "type": "pwa-chrome",
              "request": "launch",
              "name": "Python: Current file",
              "url": "http://localhost:8081",
              "webRoot": "${workspaceFolder}",
              "runtimeArgs": ["arg1", "arg2", '{"host":"https://x.xxx.xx.xxx/console","port":443,"selfSignedCert": false}', '{"auth": {"sec": "ccccccc-dddd-eeee-ffff-gggggggggg"}}', "args3"]
          }
      ]
}

但我相信這不是傳遞對象的正確方法'{"host":"https://x.xxx.xx.xxx/console","port":443,"selfSignedCert": false}''{"auth": {"sec": "ccccccc-dddd-eeee-ffff-gggggggggg"}}'

我想將對象按原樣傳遞到模塊中,即使用單引號。 有人可以幫助我以正確的方式做到這一點嗎?

Visual Studio Code 中 Python 應用程序的調試配置

參數

指定要傳遞給 Python 程序的參數。 由空格分隔的參數字符串的每個元素都應包含在引號內,例如:

"args": ["--quiet", "--norepeat", "--port", "1593"],

在參數中添加''似乎是不可能的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM