Python pdb command history not working on Windows

≡放荡痞女 提交于 2020-01-05 07:25:18

问题


I'm using Windows 7 + Cygwin + Python 2.6 + cmd prompt. Since yesterday, command line history stopped working with pdb. I used the following lines in my python code for interactive debugging.

import pdb
pdb.set_trace()

Earlier, I was able to recall the command history with up arrow but it stopped working recently. I remember adding a few cygwin packages around the time it stopped working. If there's some easy/obvious way to find what caused the error please advise or else I'll try rolling back whatever I've installed.


回答1:


Check the readline package, and its compatibility with your version of pdb. Maybe you have to downgrade.

EDIT:

As you were talking about newly installed packages on Cygwin, I was assuming that you are using Cygwin's Python. Hence my reference to Cygwin's readline package, as this might be influencing an existing Python installation.




回答2:


Re-installing python fixed it.




回答3:


After installing package pyreadline, I was able to use up/down arrow keys to go through the command history. readline does not install on Windows using pip, but pyreadline seems to be equivalent to it.



来源:https://stackoverflow.com/questions/6348034/python-pdb-command-history-not-working-on-windows

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