在Visual Studio Code中运行Node.js,将python脚本作为子进程调用并对其进行调试

时间:2019-04-20 10:01:56

标签: python node.js debugging visual-studio-code child-process

我想在nodejs创建子进程以调试python代码后立即跳入python代码

Server.js:

const spawn = require("child_process").spawn;
const pythonProcess = spawn('python',["MyPythonFile.py"]);
console.log("Finished!")

MyPythonFile.py:

print("First line I'd like to debug")
print("Second line I'd like to debug")
print("Third line I'd like to debug")

Server.js和MyPythonFile.py都位于同一目录中 有什么办法告诉Visual Studio代码将python文件附加到调试器或为python代码创建新的调试器实例?

1 个答案:

答案 0 :(得分:0)

您可以尝试在remote debugging情况下调试脚本。如果您愿意在VS代码之外启动该服务,则可以像local script一样附加到它。