小编Fre*_*mas的帖子

WinPdb错误(调试Django):CTimeoutHTTP实例没有属性'getresponse'

我正在尝试学习winpdb来调试django脚本.我有一个非常简单的django网站运行查找,如果我从命令行启动它,但当我尝试从winpdb启动它时,它给我这个错误消息:

RPDB2 - The Remote Python Debugger, version RPDB_2_4_6,
Copyright (C) 2005-2009 Nir Aides.
Type "help", "copyright", "license", "credits" for more information.

*** NEW: Use CTRL-N for auto completion in the following commands: launch,
*** eval and exec.
*** Password has been set to a random password.
*** Starting debuggee...
*** Command returned the following error:
*** <type 'exceptions.AttributeError'>, CTimeoutHTTP instance has no
*** attribute 'getresponse'.
*** Please check stderr for stack trace and report to support.
*** …
Run Code Online (Sandbox Code Playgroud)

django winpdb

6
推荐指数
2
解决办法
1858
查看次数

python confusion:dict.pop

我真的很困惑为什么Python以特定的方式行事.

这是一个例子:我有一个名为"copy"的字典.(它是django中HttpRequest.POST的副本.)

这是一个调试会话(添加了行号):

1 (Pdb) copy
2 <QueryDict: {u'text': [u'test'], u'otherId': [u'60002'], u'cmd': [u'cA'], u'id':
3  [u'15']}>
4 (Pdb) copy['text']
5  u'test'
6 (Pdb) copy.pop('text')
7  [u'test']
Run Code Online (Sandbox Code Playgroud)

我的问题是在字典中它看起来像值都是列表(它们来自django那种方式.)当我访问第4行中的元素时,我将其作为值而不是列表,但是当我访问它时pop我再次把它作为列表.

我真的很困惑.有人可以帮忙吗?

python django

2
推荐指数
1
解决办法
835
查看次数

标签 统计

django ×2

python ×1

winpdb ×1