在 Visual Studio 代码 运行 Node.js 中,调用 python 脚本作为子进程并调试它
In Visual Studio Code run Node.js, call python script as child-process and debug it
我想在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 代码创建一个新的调试器实例?
您可以尝试将脚本调试为 remote debugging situation. If you're willing to start the service outside of VS code you can attach to it like a local script。
我想在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 代码创建一个新的调试器实例?
您可以尝试将脚本调试为 remote debugging situation. If you're willing to start the service outside of VS code you can attach to it like a local script。