我在我的Mac上使用ipython==0.13.2
和ipdb==0.7
在Python 2.7.5
virtualenv中有相同的现象。当我尝试进行调试时,我已经完成了内建的选项卡,但不是当前范围内的变量。我发现,我的自定义.pdbrc
位于我的主文件夹(http://docs.python.org/2/library/pdb.html#id2)。在我评论完所有内容后,Tab完成工作再次开始。
我不知道什么时候,为什么我添加了这个文件,但是这是在那里:
# See http://docs.python.org/2/library/pdb.html#id2 for the structure of this file.
import pdb
# 'inspect x' will print the source code for a method, class or function.
alias inspect import inspect;print inspect.getsource(%1)
alias i import inspect;print inspect.getsource(%1)
# 'help x' opens the man-style help viewer from the interpretter on an object
alias help !print help(%1)
alias h !print help(%1)
# For ordinary Python objects, ppo will pretty-print members and their values.
alias ppo pp %1.__dict__
# ppio runs ppo over a sequence of objects
alias ppio pp [a.__dict__ for a in %1]
# This tries to enable tab-completion of some identifiers.
!import rlcompleter
!pdb.Pdb.complete = rlcompleter.Completer(locals()).complete
# Taken from https://gist.github.com/1125049
# There are a couple of edge cases where you can lose terminal
# echo. This should restore it next time you open a pdb.
!import termios, sys
!termios_fd = sys.stdin.fileno()
!termios_echo = termios.tcgetattr(termios_fd)
!termios_echo[3] = termios_echo[3] | termios.ECHO
!termios_result = termios.tcsetattr(termios_fd, termios.TCSADRAIN, termios_echo)
还需要进一步研究,以检查什么打破了那里的制表完成...
这也发生在OS X上,通过ipip安装ipython和ipdb,并通过easy_install安装readline(全部在virtualenv中)。你使用的环境是什么,以便我们可以缩小这个范围? – Beau 2013-07-29 19:12:56
我使用'Ubuntu 12.04',ipython和ipdb也通过pip安装。这个问题发生在虚拟环境之外以及虚拟环境之外。我得到Tab完成,但只有内置的函数/关键字(例如,当我在我的代码中创建'dic = {}'然后通过'ipdb; ipdb.set_trace()'进行调试并键入'di'时,按''tab'我只能看到'dict(','dir('和'divmod('。我看不到'dic')。 – Bentley4 2013-07-30 08:40:09
这就是我所看到的 - 完成内置但不是本地或模块。 – Beau 2013-07-30 21:37:23