How to send a script path in PyDev for debugging instead of inserting settrace in the script?

帅比萌擦擦* 提交于 2020-04-17 22:50:22

问题


I'm following a pretty old guide where one could tell PyDev a script path from another application & it would debug it, line by line in eclipse. I like this method, instead of putting settrace() breakpoints in the main script.

scriptpath = "Users/me/Desktop/script.py"
debuggerpath = "/Users/me/.p2/pool/plugins/org.python.pydev.core_7.5.0.202001101138/pysrc"

import pydev_debug as pydevd
pydevd.debug(scriptpath, debuggerpath, trace=True )

Most likely, the api has changed. What is the current method to do the same ?


回答1:


Well, I'm not sure which guide is this (I don't think there ever was a pydev_debug in PyDev).

What that module probably did is add pydevd to sys.path and then setup the current tracing in using pydevd.settrace and then called execfile (in Python 2 -- for Python 3 the exec is a bit more contrived... see: https://github.com/fabioz/PyDev.Debugger/blob/master/_pydev_imps/_pydev_execfile.py)

So, although there's no ready made solution for that, it should be relatively easy to do with the building blocks provided by PyDev.



来源:https://stackoverflow.com/questions/60570669/how-to-send-a-script-path-in-pydev-for-debugging-instead-of-inserting-settrace-i

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!