2

I am trying to get tab completion to work while running pdb on OS X 10.10.5. I have installed the homebrew version of python 2.7.13 because it appears (also see this) that Apple does not ship with a functional readline. If I have a trivial script, trivial.py

var1 = "this"
var2 = "is annoying"

and I run /usr/local/bin/python -m pdb trivial.py and on the first entry I enter import readline, rlcompleter; I subsequently can get tab completion. However, if I put in my .pdbrc

import readline
import rlcompleter

tab completion does not work. How is this not the exact same thing? Shouldn't tab completion work when put in my .pdbrc?

Community
  • 1
  • 1
irritable_phd_syndrome
  • 4,631
  • 3
  • 32
  • 60

2 Answers2

0

I get the same behavior on linux.

ie. with no .pdbrc

$ python3 -m pdb foo.py
(Pdb) in<tab> gives interact
(Pdb) interact
(Pdb) import rlcompleter
(Pdb) in<tab>
(Pdb) in input(  int(

If I have import rlcompleter in my .pdbrc I only get interact when I type in. I get this same result even after I import rlcompleter.

$ python3 -m pdb -c 'import rlcompleter' foo.py

Also prevents tab completion.

Comparing the output of

$ python3 -vv -m pdb -c 'import rlcompleter' foo.py

and

$ python3 -vv -m pdb foo.py

resulted in a segfault so I would consider this a bug. I suggest you file a bug. Mention something about the import rlcompleter could be missing the Pdb completeionkey=setting being overwritten or the cmd module could be misinitialized. FWIW here is the source I was looking at to gleam some additional info. Pdb source

netskink
  • 4,033
  • 2
  • 34
  • 46
0

I found this

Using this method I was able to get the tab completion to work. His code uses a .pdbrc in the source dir and a hidden python script in the home dir. The file has comments where to split the file into two parts.

netskink
  • 4,033
  • 2
  • 34
  • 46