简体   繁体   English

有没有办法在调试模式下使用PyScripter python解释器?

[英]is there a way to use the PyScripter python interpreter in debug mode?

I have a script I want to debug that has classes and functions that I want to test interactively in the interpreter window of PyScripter. 我有一个要调试的脚本,该脚本具有要在PyScripter的解释器窗口中进行交互测试的类和函数。 I'd like to be able to do this in debug mode. 我希望能够在调试模式下执行此操作。 Is this possible? 这可能吗?

Look into pdb . 查看pdb You can call your program's main function from within the interpreter, if you want to. 如果需要,可以从解释器中调用程序的主函数。

import pdb
def main():
    a, b = 3, 4 # Set some variables.
    d = {1:'a'}
    pdb.set_trace()
    print "All done."

Then, in the interpreter: 然后,在解释器中:

>>> from testme import main
>>> main()
>>> p a
3

显然,pyscripter没有此功能。

PyScripter Actually has a built in debugger PyScripter实际上有一个内置的调试器

Place a breakpoint on the side of the code (little dot on the edge|or| click in the code and push "F5") and then push "F9" to run in debug mode... and the "F8" to step over. 在代码的一侧放置一个断点(在代码的边上单击小点或|,然后单击“ F5”),然后按“ F9”以在调试模式下运行,然后按“ F8”以跳过。

Note: This is PyScripter Specific 注意:这是PyScripter特有的

I believe that pyScripter only allows debugging of single thread applications, and breakpoints only work in an applications main thread. 我相信pyScripter仅允许调试单线程应用程序,而断点仅在应用程序主线程中有效。 You may need to look at an external debugger like Winpdb . 您可能需要查看Winpdb之类的外部调试器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM