Python pdb command history not working on Windows

2019-07-27 11:53发布

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.

标签: python pdb
3条回答
别忘想泡老子
2楼-- · 2019-07-27 11:58

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.

查看更多
beautiful°
3楼-- · 2019-07-27 12:08

Re-installing python fixed it.

查看更多
Animai°情兽
4楼-- · 2019-07-27 12:13

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.

查看更多
登录 后发表回答