HTTP GET爆炸...... [英] HTTP GET Explodes...

查看:62
本文介绍了HTTP GET爆炸......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行HTTP GET示例
http://www.python.org/doc/current/li...-examples.html 并且运行了

陷入了一些麻烦...


>> import httplib#这适用。
conn = httplib.HTTPConnection(" ; www.python.org")#这是有效的。
conn.request(" GET"," /index.html")#这不起作用...



我得到的错误如下。有关如何摆脱

错误的任何建议?谢谢!


#开始出错...

回溯(最近一次调用最后一次):

文件"< stdin> ;",第1行,在?

文件" /usr/lib/python2.4/httplib.py",第801行,请求

self._send_request (方法,网址,正文,标题)

文件" /usr/lib/python2.4/httplib.py" ;,第818行,在_send_request中

self.putrequest (方法,网址,**跳过)

文件" /usr/lib/python2.4/httplib.py" ;,第749行,在putrequest中

self.putheader (''Host'',self.host.encode(" idna"))

文件" /usr/lib/python2.4/encodings / __ init __。py",第96行,in

search_function

globals(),locals(),_ import_tail)

文件" /usr/lib/python2.4/encodings/idna .py,第6行,在?

dots = re.compile(u[\ u002E\\\。 \\\\\\\\\\\\\\\\\文件/usr/lib/python2.4/sre.py" ;,第180行,编译中

返回_compile(pattern,flags)

文件" /usr/lib/python2.4/sre.py" ;,第225行,在_compile

p = sre_compile.compile(pattern ,标志)

文件" /usr/lib/python2.4/sre_compile.py" ;,第500行,编译中

code = _code(p,flags)

文件" /usr/lib/python2.4/sre_compile.py" ;,第481行,_code

_compile_info(代码,p,标志)

文件" /usr/lib/python2.4/sre_compile.py" ;,第459行,_compile_info

_compile_charset(charset,flags,code)

文件" /usr/lib/python2.4/sre_compile.py" ;,第178行,在

_compile_charset

for op,av in _optimize_charset(charset,fixup):

文件" /usr/lib/python2.4/sre_compile.py" ;,第221行,在

_optimize_charset

return _optimize_unicode(charset, fixup)

文件" /usr/lib/python2.4/sre_compile.py" ;,第341行,

_optimize_unicode

mapping = array.array( '' b '',mapping).tostring()

解决方案



Pete写道:
< blockquote class =post_quotes>
我正在运行HTTP GET示例
http://www.python.org/doc/current/li...-examples.html 并运行

到一点点麻烦......


> import httplib#这个有效。
conn = httplib.HTTPConnection(" www .python.org")#这有效。
conn.request(" GET"," /index.html")#这不起作用...



我得到的错误如下。有关如何摆脱

错误的任何建议?谢谢!



你有* ONE *错误,有一个很长的回溯,这是不完整的,

因为它没有显示错误信息这应该是回溯的结尾。
$ blockquote class =post_quotes>
>

#开始出错......

回溯(最近一次调用最后一次):

文件"< stdin>",第1行,在?

文件" /usr/lib/python2.4/httplib.py",第801行,请求

self._send_request(方法,网址,正文,标题)

文件" /usr/lib/python2.4/httplib.py" ;,第818行,在_send_request中

self.putrequest(方法,网址,**跳过)

文件" /usr/lib/python2.4/httplib.py" ;,第749行,在putrequest中

self.putheader(''Host'',self.host.encode(" idna"))

文件" /usr/lib/python2.4/encodings / __ init __。py",第96行,在

search_function

globals() ,locals(),_ im port_tail)

文件" /usr/lib/python2.4/encodings/idna.py" ;,第6行,在?

dots = re.compile(u" [\ u002E\\\。 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ />
Python 2.4.3的Windows发行版:


| Python 2.4.3(#69,2006年3月29日,17:35:34)[MSC v.1310 32位(英特尔)]
win32上的


|输入帮助,版权,信用等。或许可证或更多

信息。

| >>导入重新

| >> dots = re.compile(u[\ u002E\\\。 \\\\\\\\\\\\\\\\\\\\\\\\\ >> dots.match(''。'')

| < _sre.SRE_Match对象位于0x00AF6058#bonus:编译的正则表达式工作。

| >> dots.match(u''\\\。'')

| < _sre.SRE_Match对象位于0x00AF6918>


您似乎正在运行2.4.n;什么是n,以及你在哪个* x

平台上运行它?也许/usr/lib/python2.4中的文件是损坏的,但是在你给* full * traceback之前我们不会知道。当你尝试我在翻译时所做的事情,你是否获得了相同的结果

交互式提示?


文件/usr/lib/python2.4/sre.py" ;,第180行,编译中

返回_compile(模式,标志)

文件/ usr /lib/python2.4/sre.py" ;,第225行,在_compile中

p = sre_compile.compile(pattern,flags)

文件" / usr / lib / python2.4 / sre_compile.py",第500行,编译中

code = _code(p,flags)

文件" /usr/lib/python2.4/ sre_compile.py",第481行,_code

_compile_info(代码,p,标志)

文件" /usr/lib/python2.4/sre_compile.py" ,第459行,_compile_info

_compile_charset(charset,flags,code)

文件" /usr/lib/python2.4/sre_compile.py" ;,第178行,在

_compile_charset

for op,av in _optimize_charset(charset,fixup):

File&qu ot; /usr/lib/python2.4/sre_compile.py" ;,第221行,在

_optimize_charset

返回_optimize_unicode(charset,fixup)

文件" /usr/lib/python2.4/sre_compile.py" ;,第341行,在

_optimize_unicode

mapping = array.array(''b' ',mapping).tostring()



....将在下一集继续播放。


问候,

John


淡入第二集......


...

这是编译一个*常量*正则表达式,并且在Python 2.4.3的
Windows发行版中运行正常:



嗯。这里是版本信息的东西:


Python 2.4.2(#1,2006年2月12日,03:59:46)

[GCC 4.1 .02 20060210(Red Hat 4.1.0-0.24)] on linux2


我要升级Python,看看是否有任何影响...

我在Fedora Core 5盒子上运行这个...


...

你似乎正在运行2.4.n;什么是n,以及你在哪个* x

平台上运行它?也许/usr/lib/python2.4中的文件是损坏的,但是在你给* full * traceback之前我们不会知道。当你尝试我在翻译时所做的事情时,你能获得相同的结果

交互式提示吗?



我收到的错误来自交互式提示。有没有

某种方式我可以获得更详细的信息或更好的信息

更有帮助?


谢谢,

Pete


...


我要走了升级Python,看看是否有任何影响...

...



我升级了Python,它有效果,但是不是积极的。我的

互动性如下。 Hello World在哪里?文字来自?


Python 2.4.3(#1,2006年6月13日,11:46:08)

[GCC 4.1.1 20060525(红色)在Linux2上的帽子4.1.1-1)]


>> import httplib
conn = httplib.HTTPConnection(" www.python.org")
conn.request(" GET"," /index.html")



Hello World。

Traceback(最近一次调用最后一次):

文件"< stdin>",第1行,在?

文件" /usr/lib/python2.4/httplib.py",第804行,请求

self._send_request(方法,网址,正文,标题)

文件" /usr/lib/python2.4/httplib.py" ;,第821行,在_send_request中

self.putrequest(方法,网址,**跳过)

文件" /usr/lib/python2.4/httplib.py" ;,第752行,在putrequest中

self.putheader(''Host'',self.host.encode(" idna"))

文件" /usr/lib/python2.4/encodings / __ init __。py",第96行,

search_function

globals(), locals(),_ import&tail)

文件" /usr/lib/python2.4/encodings/idna.py" ;,第6行,在?

dots = re。编译(u[\ u002E \ u3002 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\编译

返回_compile(模式,标志)

文件" /usr/lib/python2.4/sre.py" ;,第225行,在_compile中

p = sre_compile.compile(pattern,flags)

文件" /usr/lib/python2.4/sre_compile.py" ;,第500行,编译中

code = _code(p,flags)

文件" /usr/lib/python2.4/sre_compile.py" ;,第481行,_code

_compile_info(代码,p,flags)

文件" /usr/lib/python2.4/sre_compile.py" ;,第459行,在_compile_info

_compile_charset(charset,flags,code )

文件" /usr/lib/python2.4/sre_compile.py" ;,第178行,在

_compile_charset

for op, av in _optimize_charset(charset,fixup):

Fil e" /usr/lib/python2.4/sre_compile.py" ;,第221行,在

_optimize_charset

返回_optimize_unicode(charset,fixup)

文件" /usr/lib/python2.4/sre_compile.py" ;,第341行,在

_optimize_unicode

mapping = array.array(''b '',mapping).tostring()

TypeError:typecode参数必须是有效类型。


>>>


I was running the HTTP GET example at
http://www.python.org/doc/current/li...-examples.html and ran
into a bit of trouble...

>>import httplib # This works.
conn = httplib.HTTPConnection("www.python.org") # This works.
conn.request("GET", "/index.html") # This does not work...

The errors I get are below. Any suggestions on how to get rid of the
errors? Thanks!

# Begin errors...
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/httplib.py", line 801, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.4/httplib.py", line 818, in _send_request
self.putrequest(method, url, **skips)
File "/usr/lib/python2.4/httplib.py", line 749, in putrequest
self.putheader(''Host'', self.host.encode("idna"))
File "/usr/lib/python2.4/encodings/__init__.py", line 96, in
search_function
globals(), locals(), _import_tail)
File "/usr/lib/python2.4/encodings/idna.py", line 6, in ?
dots = re.compile(u"[\u002E\u3002\uFF0E\uFF61]")
File "/usr/lib/python2.4/sre.py", line 180, in compile
return _compile(pattern, flags)
File "/usr/lib/python2.4/sre.py", line 225, in _compile
p = sre_compile.compile(pattern, flags)
File "/usr/lib/python2.4/sre_compile.py", line 500, in compile
code = _code(p, flags)
File "/usr/lib/python2.4/sre_compile.py", line 481, in _code
_compile_info(code, p, flags)
File "/usr/lib/python2.4/sre_compile.py", line 459, in _compile_info
_compile_charset(charset, flags, code)
File "/usr/lib/python2.4/sre_compile.py", line 178, in
_compile_charset
for op, av in _optimize_charset(charset, fixup):
File "/usr/lib/python2.4/sre_compile.py", line 221, in
_optimize_charset
return _optimize_unicode(charset, fixup)
File "/usr/lib/python2.4/sre_compile.py", line 341, in
_optimize_unicode
mapping = array.array(''b'', mapping).tostring()

解决方案


Pete wrote:

I was running the HTTP GET example at
http://www.python.org/doc/current/li...-examples.html and ran
into a bit of trouble...

>import httplib # This works.
conn = httplib.HTTPConnection("www.python.org") # This works.
conn.request("GET", "/index.html") # This does not work...


The errors I get are below. Any suggestions on how to get rid of the
errors? Thanks!

You have *ONE* error, with a long traceback, which is incomplete,
because it doesn''t show the error message that should be at the end of
the traceback.

>
# Begin errors...
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/httplib.py", line 801, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.4/httplib.py", line 818, in _send_request
self.putrequest(method, url, **skips)
File "/usr/lib/python2.4/httplib.py", line 749, in putrequest
self.putheader(''Host'', self.host.encode("idna"))
File "/usr/lib/python2.4/encodings/__init__.py", line 96, in
search_function
globals(), locals(), _import_tail)
File "/usr/lib/python2.4/encodings/idna.py", line 6, in ?
dots = re.compile(u"[\u002E\u3002\uFF0E\uFF61]")

This is compiling a *constant* regular expression, and works OK on the
Windows distribution of Python 2.4.3 :

| Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)]
on win32
| Type "help", "copyright", "credits" or "license" for more
information.
| >>import re
| >>dots = re.compile(u"[\u002E\u3002\uFF0E\uFF61]")
| >>dots.match(''.'')
| <_sre.SRE_Match object at 0x00AF6058# bonus: compiled regex works.
| >>dots.match(u''\uff61'')
| <_sre.SRE_Match object at 0x00AF6918>

You appear to be running 2.4.n; what is n, and exactly which *x
platform are you running it on? Perhaps a file in /usr/lib/python2.4 is
corrupt, but we won''t know until you give the *full* traceback. Do you
get the same results when you try what I did at the interpreter
interactive prompt?

File "/usr/lib/python2.4/sre.py", line 180, in compile
return _compile(pattern, flags)
File "/usr/lib/python2.4/sre.py", line 225, in _compile
p = sre_compile.compile(pattern, flags)
File "/usr/lib/python2.4/sre_compile.py", line 500, in compile
code = _code(p, flags)
File "/usr/lib/python2.4/sre_compile.py", line 481, in _code
_compile_info(code, p, flags)
File "/usr/lib/python2.4/sre_compile.py", line 459, in _compile_info
_compile_charset(charset, flags, code)
File "/usr/lib/python2.4/sre_compile.py", line 178, in
_compile_charset
for op, av in _optimize_charset(charset, fixup):
File "/usr/lib/python2.4/sre_compile.py", line 221, in
_optimize_charset
return _optimize_unicode(charset, fixup)
File "/usr/lib/python2.4/sre_compile.py", line 341, in
_optimize_unicode
mapping = array.array(''b'', mapping).tostring()

.... to be continued in the next episode.

Regards,
John


Fade in to episode II...

...
This is compiling a *constant* regular expression, and works OK on the
Windows distribution of Python 2.4.3 :

Hmmmm. Here''s the version information stuff:

Python 2.4.2 (#1, Feb 12 2006, 03:59:46)
[GCC 4.1.0 20060210 (Red Hat 4.1.0-0.24)] on linux2

I''m going to upgrade Python and see if that has any effect...
I''m running this on a Fedora Core 5 box...

...
You appear to be running 2.4.n; what is n, and exactly which *x
platform are you running it on? Perhaps a file in /usr/lib/python2.4 is
corrupt, but we won''t know until you give the *full* traceback. Do you
get the same results when you try what I did at the interpreter
interactive prompt?

The error I received was from the interactive prompt thing. Is there
some way I can get more verbose information or something that would be
more helpful?

Thanks,
Pete


...

I''m going to upgrade Python and see if that has any effect...
...

I upgraded Python, it had an effect, but not a positive one. My
interactivity is below. Where is the "Hello World." text coming from?

Python 2.4.3 (#1, Jun 13 2006, 11:46:08)
[GCC 4.1.1 20060525 (Red Hat 4.1.1-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>import httplib
conn = httplib.HTTPConnection("www.python.org")
conn.request("GET", "/index.html")

Hello World.
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/httplib.py", line 804, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.4/httplib.py", line 821, in _send_request
self.putrequest(method, url, **skips)
File "/usr/lib/python2.4/httplib.py", line 752, in putrequest
self.putheader(''Host'', self.host.encode("idna"))
File "/usr/lib/python2.4/encodings/__init__.py", line 96, in
search_function
globals(), locals(), _import_tail)
File "/usr/lib/python2.4/encodings/idna.py", line 6, in ?
dots = re.compile(u"[\u002E\u3002\uFF0E\uFF61]")
File "/usr/lib/python2.4/sre.py", line 180, in compile
return _compile(pattern, flags)
File "/usr/lib/python2.4/sre.py", line 225, in _compile
p = sre_compile.compile(pattern, flags)
File "/usr/lib/python2.4/sre_compile.py", line 500, in compile
code = _code(p, flags)
File "/usr/lib/python2.4/sre_compile.py", line 481, in _code
_compile_info(code, p, flags)
File "/usr/lib/python2.4/sre_compile.py", line 459, in _compile_info
_compile_charset(charset, flags, code)
File "/usr/lib/python2.4/sre_compile.py", line 178, in
_compile_charset
for op, av in _optimize_charset(charset, fixup):
File "/usr/lib/python2.4/sre_compile.py", line 221, in
_optimize_charset
return _optimize_unicode(charset, fixup)
File "/usr/lib/python2.4/sre_compile.py", line 341, in
_optimize_unicode
mapping = array.array(''b'', mapping).tostring()
TypeError: typecode argument must be a valid type.

>>>


这篇关于HTTP GET爆炸......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆