以下のサイトを参考にして、vscodeでpythonファイルをリモートデバッグしようとしたのですがうまくいきません。デバッグしようとすると、接続できません(Failed to attachが出てくる)
pythonファイルはローカルとリモートの両方に入れました。
ローカルはWSL、リモートサーバーはUbuntsuです。
(launch.jsonのhost-adressには接続したいサーバーのアドレスを入れています)
どうすればいいのかご教授お願いいたします。
Python Remote Debug
##hello.py
python
1def main(): 2 3 import ptvsd 4 ptvsd.enable_attach() 5 ptvsd.wait_for_attach() 6 7 msg = "hello world" 8 print(msg) 9 10if __name__ == '__main__': 11 main()
##launch.json
json
1{ 2 // IntelliSense を使用して利用可能な属性を学べます。 3 // 既存の属性の説明をホバーして表示します。 4 // 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387 5 "version": "0.2.0", 6 "configurations": [ 7 8 { 9 "name": "Python: Current File", 10 "type": "python", 11 "port":5678, 12 "host":"host-adress", 13 "request": "attach", 14 "pathMappings": [ 15 { 16 "localRoot": "${workspaceFolder}", 17 "remoteRoot": "/home/matsu/work/Remote/" 18 } 19 ], 20 } 21 ] 22}
あなたの回答
tips
プレビュー