Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

python-3.x - 使用vscode断点调试subprocess.call(Debug subprocess.call using vscode breakpoint)

I am using subprocess.call to execute a Python script.

(我正在使用subprocess.call来执行Python脚本。)

I do this because I am using a code I did not write and this is the fastest way to make it work.

(之所以这样做,是因为我使用的是我未编写的代码,这是使其工作最快的方法。)

However, I would like to be able to debug within the script launched by subprocess.call using the breakpoint functionnality of vscode.

(但是,我希望能够使用vscode的断点功能在subprocess.call启动的脚本中进行调试。)

So imagine I got a myScript.py that looks like this and launches a subscript.py :

(因此,想象一下我得到了一个myScript.py ,它看起来像这样,并启动了一个subscript.py :)

import subprocess
import os
subprocess.call(['python', os.path.join(os.path.dirname(__file__), "subScript.py"), 
                ])

If I put a breakpoint in subscript.py , vscode does not stop.

(如果我在subscript.py放置一个断点,vscode不会停止。)

Is there a way to achieve this ?

(有办法实现吗?)

  ask by FenryrMKIII translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...