2

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.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
user
  • 17,781
  • 20
  • 98
  • 124
  • Are you in fact using cmd prompt? Or rather bash? – ThomasH Jun 14 '11 at 19:35
  • Are you using Cygwin's Python, or a native Windows Python installation? – ThomasH Jun 15 '11 at 11:01
  • native Windows Python installation – user Jun 15 '11 at 11:29
  • Then it is indeed very strange why this should be influenced by changes to the Cygwin installation, they should be entirely unrelated. Have you added Cygwin's bin folder to cmd's %PATH% setting? – ThomasH Jun 15 '11 at 20:54
  • Thanks for helping. Yes, python.exe & cygwin/bin have been on PATH setting always. Nothing changed. – user Jun 16 '11 at 06:41
  • Yes, but that means that changes to your Cygwin environment might leak into the Python execution. Remove cygwin/bin from PATH in a cmd shell, then run Python/pdb, see if that changes something. Also check if you have environment settings like PYTHON_PATH pointing to cygwin/ in you cmd. – ThomasH Jun 16 '11 at 10:00

3 Answers3

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.

user2233706
  • 6,148
  • 5
  • 44
  • 86
0

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.

ThomasH
  • 22,276
  • 13
  • 61
  • 62
  • I didn't have readline on Windows. History works on interactive python shell but not with pdb – user Jun 15 '11 at 04:59
0

Re-installing python fixed it.

user
  • 17,781
  • 20
  • 98
  • 124
  • I am having the same issue and raised a question for this, https://stackoverflow.com/questions/48764584/no-command-history-in-python-repl-when-using-with-cygwin-under-windows-7 Then I came across your post and tried your solution but sadly it didnt resolve my issue – robbie70 Feb 13 '18 at 10:48