ipython样式选项卡包含用于导入模块的ipdb

时间:2014-11-22 00:20:05

标签: ipython pdb ipdb

我试图通过使用ipdb来使用pdb完成ipython样式表。

在干净的ubuntu 14.04安装(新aws实例)上运行。

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install python-setuptools
sudo easy_install pip

sudo pip install ipython
sudo pip install ipdb
sudo pip install boto

然后启动ipython,尝试。

ubuntu@ip-10-0-0-244:~$ ipython
Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
Type "copyright", "credits" or "license" for more information.

IPython 2.3.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import ipdb

In [2]: import boto

In [3]: ipdb.set_trace()
--Call--
> /usr/local/lib/python2.7/dist-packages/IPython/core/displayhook.py(234)__call__()
    233 
--> 234     def __call__(self, result=None):
    235         """Printing with history cache management.

ipdb> str.
str.capitalize  str.encode      str.format      str.isdigit     str.isupper     str.lstrip      str.rfind       str.rsplit      str.startswith  str.translate   
str.center      str.endswith    str.index       str.islower     str.join        str.mro         str.rindex      str.rstrip      str.strip       str.upper       
str.count       str.expandtabs  str.isalnum     str.isspace     str.ljust       str.partition   str.rjust       str.split       str.swapcase    str.zfill       
str.decode      str.find        str.isalpha     str.istitle     str.lower       str.replace     str.rpartition  str.splitlines  str.title       
ipdb> boto.

boto。[tab]就在那里。如果我正确地阅读文档,这应该有用,但也许我错过了一些东西。

如果我定义一个简单的脚本test.py

import boto

print(boto.__version__)

然后致电:

ubuntu@ip-10-0-0-244:~$ python -m ipdb test.py 
> /home/ubuntu/test.py(1)<module>()
----> 1 import boto
      2 
      3 print(boto.__version__)

ipdb> n
> /home/ubuntu/test.py(3)<module>()
      1 import boto
      2 
----> 3 print(boto.__version__)

ipdb> boto.
boto.BUCKET_NAME_RE             boto.connect_autoscale          boto.connect_emr                boto.connect_s3                 boto.os
boto.BotoConfigLocations        boto.connect_beanstalk          boto.connect_euca               boto.connect_sdb                boto.perflog
boto.BucketStorageUri           boto.connect_cloudformation     boto.connect_fps                boto.connect_ses                boto.platform
boto.Config                     boto.connect_cloudfront         boto.connect_glacier            boto.connect_sns                boto.plugin
boto.ENDPOINTS_PATH             boto.connect_cloudsearch        boto.connect_gs                 boto.connect_sqs                boto.pyami
boto.FileStorageUri             boto.connect_cloudsearch2       boto.connect_ia                 boto.connect_sts                boto.re
boto.GENERATION_RE              boto.connect_cloudtrail         boto.connect_iam                boto.connect_support            boto.regioninfo
boto.InvalidUriError            boto.connect_cloudwatch         boto.connect_kinesis            boto.connect_swf                boto.resultset
boto.NullHandler                boto.connect_cognito_identity   boto.connect_logs               boto.connect_vpc                boto.s3
boto.TOO_LONG_DNS_NAME_COMP     boto.connect_cognito_sync       boto.connect_mturk              boto.connect_walrus             boto.set_file_logger
boto.UserAgent                  boto.connect_directconnect      boto.connect_opsworks           boto.datetime                   boto.set_stream_logger
boto.VERSION_RE                 boto.connect_dynamodb           boto.connect_rds                boto.exception                  boto.storage_uri
boto.Version                    boto.connect_ec2                boto.connect_rds2               boto.handler                    boto.storage_uri_for_key
boto.boto                       boto.connect_ec2_endpoint       boto.connect_redshift           boto.init_logging               boto.sys
boto.compat                     boto.connect_elastictranscoder  boto.connect_route53            boto.log                        boto.urlparse
boto.config                     boto.connect_elb                boto.connect_route53domains     boto.logging                    boto.vendored

我得到了我想要的行为。

有谁知道如何使标签完整功能适用于set_trace()工作案例?

-Thanks

0 个答案:

没有答案