gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 21:00:00 25 4
gpt4 key购买 nike

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

服务器.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 Code 将 python 文件附加到调试器或为 python 代码创建一个新的调试器实例?

最佳答案

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

关于python - 在 Visual Studio Code 中运行 Node.js,将 python 脚本作为子进程调用并调试它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55772378/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com