[A-00055]VSCode上でpythonをデバッグする
vscodeを使用してpythonをデバッグ実行する方法を記載しておく。
まず[lanch.json]をvscodeの設定情報が格納される[,vscode]ディレクトリに格納する。

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: FastAPI",
"type": "python",
"request": "launch",
"module": "uvicorn",
"jinja": true,
"justMyCode": true
},
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true
}
]
}
次にvscodeの左側のメニューから下記のアイコンを押下して画面表示をデバッグモードに切り替える。

画面上部にあるPythonの実行コマンドを選択するプルダウンで[Python:Current File]を選択するとエディターに表示しているpythonファイルを実行することができる。実行すると下記のようにデバッグポイントで止めてくれるようになる。

コメントを残す