关于多线程采集的问题.

2013-11-18 08:33:38 +08:00
 crny520
BadStatusLine: ''
raise BadStatusLine(line)
File "/usr/lib/python2.7/httplib.py", line 371, in _read_status
version, status, reason = self._read_status()
File "/usr/lib/python2.7/httplib.py", line 407, in begin
response.begin()
File "/usr/lib/python2.7/httplib.py", line 1030, in getresponse
response = conn.getresponse()
File "taskblog.py", line 62, in get_remote_data
self.__target(*self.__args, **self.__kwargs)
File "/usr/lib/python2.7/threading.py", line 504, in run
self.run()
File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
Traceback (most recent call last):
Exception in thread Thread-1:

我用到队列和多线程,用httplib类,try conn.getresponse() 取得数据,无论用try都会使该线程出错.有没有方法处理?
3232 次点击
所在节点    Python
1 条回复
likexian
2013-11-18 09:48:39 +08:00
BadStatusLine 目测对方网站返回了非200

话说你代码什么都没有,光有这个说个j8

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/89634

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX