简体   繁体   English

如何使用两个终端窗口调试Python curses代码

[英]How to debug Python curses code using two terminal windows

I am writing a Python code using curses library under Linux. 我正在Linux下使用curses库编写Python代码。 Are there any debugger does not share the same terminal, so I can debug alone with the code running? 是否有任何调试器不共享同一终端,所以我可以在运行代码的情况下单独调试?

EDIT: 编辑:

I tried WinPDB, but it works only with python 2.7, and I am using 3.3 我尝试使用WinPDB,但仅适用于python 2.7,而我使用的是3.3

IPython supports embedding a “kernel” which can then connect to an external front-end, such as a Qt one (qtconsole). IPython支持嵌入“内核”,然后可以连接到外部前端,例如Qt one(qtconsole)。

For working with another tty, I'd suggest connecting the debugger with another tty either via a pair of pipes or a pty (pseudo terminal), although you'd probably have to write the “other half” to display in the terminal, whereas the qtconsole is already ready to use as-is. 对于使用另一个tty,我建议通过一对管道或pty(伪终端)将调试器与另一个tty连接,尽管您可能不得不编写“另一半”以在终端中显示,而qtconsole已经准备好按原样使用。

You install the Debian package ipython-qtconsole (or the Py3k version ipython3-qtconsole), then just run “ipython qtconsole” on the command line to get a GUI window containing the debugger. 您安装Debian软件包ipython-qtconsole(或Py3k版本的ipython3-qtconsole),然后在命令行上运行“ ipython qtconsole”以获取包含调试器的GUI窗口。

Embedding is also possible: you can modify your program to call the ipython “kernel” at some point which is like setting a breakpoint. 嵌入也是可能的:您可以修改程序以在某个点调用ipython“ kernel”,就像设置断点一样。

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

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