2013-04-12 6 views
7

TABは、(pdb)プロンプトでタブを挿入する以外のことを行うようにしています。PDBのオートコンプリートとタブキー

herehereなどのオートコンプリートをトリガしていますが、タブキーはpdbにタブを追加する以外のことはしません。そう

 
(pdb)var + tabKeyPressed 

私が取得したいと思います:

 
(pdb)variable 

の代わり:救助へ

 
(pdb)var[   ] 
+0

に基づいて、両方の同封のリンクが魅力のように働いていた別のコンピュータで、私のPythonのインストールで何かだったようです。 –

答えて

4

iPythonは、この問題のサードパーティソリューションです。場合によっては、バニラのPythonだけに頼ることもできます。私は2つの解決策を見つけました。

パー・シェルソリューション - 使用モジュール 'rlcompleter':

$ python3 

Python 3.4.3 (default, Sep 14 2016, 12:36:27) 
[GCC 4.8.4] on linux 
Type "help", "copyright", "credits" or "license" for more information. 

>>> import pdb 
>>> pdb.set_trace() 
--Return-- 
> <stdin>(1)<module>()->None 

# press tab - but nothing 
(Pdb) str. 
*** SyntaxError: invalid syntax 
(Pdb) --KeyboardInterrupt-- 
(Pdb) c 
>>> import rlcompleter 
>>> pdb.Pdb.complete=rlcompleter.Completer(locals()).complete 
>>> pdb.set_trace() 
--Return-- 
> <stdin>(1)<module>()->None 
(Pdb) str. 
str.__add__(   str.__getattribute__( str.__name__   str.__text_signature__ str.isdigit(   str.rfind(
str.__base__(   str.__getitem__(  str.__ne__(   str.__weakrefoffset__ str.isidentifier(  str.rindex(
str.__bases__   str.__getnewargs__( str.__new__(   str.capitalize(  str.islower(   str.rjust(
str.__basicsize__  str.__gt__(   str.__prepare__(  str.casefold(   str.isnumeric(   str.rpartition(
str.__call__(   str.__hash__(   str.__qualname__  str.center(   str.isprintable(  str.rsplit(
str.__class__(   str.__init__(   str.__reduce__(  str.count(    str.isspace(   str.rstrip(
str.__contains__(  str.__instancecheck__( str.__reduce_ex__(  str.encode(   str.istitle(   str.split(
str.__delattr__(  str.__itemsize__  str.__repr__(   str.endswith(   str.isupper(   str.splitlines(
str.__dict__   str.__iter__(   str.__rmod__(   str.expandtabs(  str.join(    str.startswith(
str.__dictoffset__  str.__le__(   str.__rmul__(   str.find(    str.ljust(    str.strip(
str.__dir__(   str.__len__(   str.__setattr__(  str.format(   str.lower(    str.swapcase(
str.__doc__    str.__lt__(   str.__sizeof__(  str.format_map(  str.lstrip(   str.title(
str.__eq__(   str.__mod__(   str.__str__(   str.index(    str.maketrans(   str.translate(
str.__flags__   str.__module__   str.__subclasscheck__( str.isalnum(   str.mro(    str.upper(
str.__format__(  str.__mro__    str.__subclasses__( str.isalpha(   str.partition(   str.zfill(
str.__ge__(   str.__mul__(   str.__subclasshook__( str.isdecimal(   str.replace(   
(Pdb) c 
>>> 

システム全体のソリューション - 使用量ファイル〜/ .pdbrc

$ cat ~/.pdbrc 
import rlcompleter 
pdb.Pdb.complete=rlcompleter.Completer(locals()).complete 
$ python3 
Python 3.4.3 (default, Sep 14 2016, 12:36:27) 
[GCC 4.8.4] on linux 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import pdb 
>>> pdb.set_trace() 
--Return-- 
> <stdin>(1)<module>()->None 
(Pdb) str. 
str.__add__(   str.__getattribute__( str.__name__   str.__text_signature__ str.isdigit(   str.rfind(
str.__base__(   str.__getitem__(  str.__ne__(   str.__weakrefoffset__ str.isidentifier(  str.rindex(
str.__bases__   str.__getnewargs__( str.__new__(   str.capitalize(  str.islower(   str.rjust(
str.__basicsize__  str.__gt__(   str.__prepare__(  str.casefold(   str.isnumeric(   str.rpartition(
str.__call__(   str.__hash__(   str.__qualname__  str.center(   str.isprintable(  str.rsplit(
str.__class__(   str.__init__(   str.__reduce__(  str.count(    str.isspace(   str.rstrip(
str.__contains__(  str.__instancecheck__( str.__reduce_ex__(  str.encode(   str.istitle(   str.split(
str.__delattr__(  str.__itemsize__  str.__repr__(   str.endswith(   str.isupper(   str.splitlines(
str.__dict__   str.__iter__(   str.__rmod__(   str.expandtabs(  str.join(    str.startswith(
str.__dictoffset__  str.__le__(   str.__rmul__(   str.find(    str.ljust(    str.strip(
str.__dir__(   str.__len__(   str.__setattr__(  str.format(   str.lower(    str.swapcase(
str.__doc__    str.__lt__(   str.__sizeof__(  str.format_map(  str.lstrip(   str.title(
str.__eq__(   str.__mod__(   str.__str__(   str.index(    str.maketrans(   str.translate(
str.__flags__   str.__module__   str.__subclasscheck__( str.isalnum(   str.mro(    str.upper(
str.__format__(  str.__mro__    str.__subclasses__( str.isalpha(   str.partition(   str.zfill(
str.__ge__(   str.__mul__(   str.__subclasshook__( str.isdecimal(   str.replace(   
(Pdb) c 
>>> 

注:

  1. thでのみテスト済み電子のPython 3.4

  2. OS - Linuxのミント

  3. https://reminiscential.wordpress.com/2009/06/12/python-enable-auto-complete-in-a-pdb-session/

7

ipdbタブ補完、構文の強調表示、良好トレースバック、PDBモジュールと同じインタフェースとのより良い 内観を特徴IPythonデバッガを、アクセスへの輸出機能ipdb

+1

しばらく試してみたところ、商品をお届けしました。私はそれほど好きではない。 –

関連する問題