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

ipython样式选项卡,包含用于导入模块的ipdb,ipython,pdb,ipdb,Ipython,Pdb,Ipdb,我试图通过使用ipdb使ipython样式的表与pdb一起完成 在一个干净的ubuntu 14.04安装(新的aws实例)上运行 然后启动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 enh

我试图通过使用ipdb使ipython样式的表与pdb一起完成

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

然后启动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.
波托坐在那里。如果我读对了文档,这应该行得通,但也许我错过了一些理解

如果我定义一个简单的脚本
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
ubuntu@ip-10-0-0-244:~$python-m ipdb test.py
>/home/ubuntu/test.py(1)()
---->1进口波托
2.
3份打印(boto.\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
ipdb>n
>/home/ubuntu/test.py(3)()
1进口波托
2.
---->3份打印(boto.\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
ipdb>boto。
boto.BUCKET\u NAME\u RE boto.connect\u自动缩放boto.connect\u emr boto.connect\u s3 boto.os
boto.BotoConfigLocations boto.connect\u beanstalk boto.connect\u euca boto.connect\u sdb boto.perflog
boto.BucketStorageUri boto.connect\u cloudformation boto.connect\u fps boto.connect\u使用boto.platform
boto.Config boto.connect\u cloudfront boto.connect\u glacier boto.connect\u sns boto.plugin
boto.ENDPOINTS\u PATH boto.connect\u cloudsearch boto.connect\u gs boto.connect\u sqs boto.pyami
boto.FileStorageUri boto.connect\u cloudsearch2 boto.connect\u ia boto.connect\u sts boto.re
boto.GENERATION\u RE boto.connect\u cloudtrail boto.connect\u iam boto.connect\u支持boto.regioninfo
boto.InvalidUriError boto.connect\u cloudwatch boto.connect\u kinesis boto.connect\u swf boto.resultset
boto.NullHandler boto.connect\u cognito\u identity boto.connect\u logs boto.connect\u vpc boto.s3
boto.TOO_LONG_DNS_NAME_COMP boto.connect_cognito_sync boto.connect_mturk boto.connect_walrus boto.set_文件记录器
boto.UserAgent boto.connect\u directconnect boto.connect\u opsworks boto.datetime boto.set\u stream\u logger
boto.VERSION\u RE boto.connect\u dynamodb boto.connect\u rds boto.exception boto.storage\u uri
boto.Version boto.connect\u ec2 boto.connect\u rds2 boto.handler boto.storage\u uri\u用于密钥
boto.boto boto.connect\u ec2\u endpoint boto.connect\u redshift boto.init\u logging boto.sys
boto.compat boto.connect\u elastictranscoder boto.connect\u route53 boto.log boto.urlparse
boto.config boto.connect\u elb boto.connect\u route53域boto.logging boto.vendored
我得到了我想要的行为

有人知道如何使选项卡的完整功能适用于set_trace()工作案例吗


-谢谢

您能解释一下您希望它工作的实际用例吗?在ipython会话中直接调用set_trace()看起来像是一个人工用例,所以如果它没有按预期工作,那么应该不会有问题。我正在编写一系列脚本来监控我的aws资源。我正在使用ipython进行开发,因为ipython,并且在大多数boto对象上都有很多方法,所以在tabcomplete中查看可用选项非常有用。我发现自己一直在循环中使用set_trace(),我想让所有的东西都在连接中对齐。(比如为每个实例更新cloudwatch警报,并尝试正确设置过滤器。)
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