我正在使用Visual Studio Code编写我的python应用程序。如果我编写了一个简单的同步单文件程序,则检查变量和在左侧调试 Pane 中设置监视之类的事情就可以了。
但是,我在多个文件中都有带有类的代码,并使用来自其他模块的各种回调。一些启动新线程。
这些模块之一是canopen
我可以遍历代码,但是当我输入第二行时(如下)
can0 = canopen.Network()
can0.connect(channel='can0', bustype='socketcan')
然后调用堆栈从:
CALL STACK paused on breakpoint
main
<module>
到
CALL STACK paused on breakpoint
MainThread
Thread#15034.........
同时
can0: not available
如何(使用Python设置VS Studio代码)使用各种线程和各种文件中的代码检查/调试python代码?
问候,
巴斯
最佳答案
新的调试器能够调试异步应用程序。
了解如何设置
How to update ptvsd used by Visual Studio Code in debug mode
并且不要忘记在launch.json中添加“subProcess”:true