V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
crny520
V2EX  ›  Python

关于多线程采集的问题.

  •  
  •   crny520 · 2013-11-18 08:33:38 +08:00 · 3216 次点击
    这是一个创建于 3814 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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都会使该线程出错.有没有方法处理?
    1 条回复    1970-01-01 08:00:00 +08:00
    likexian
        1
    likexian  
       2013-11-18 09:48:39 +08:00   ❤️ 1
    BadStatusLine 目测对方网站返回了非200

    话说你代码什么都没有,光有这个说个j8
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1092 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 18:41 · PVG 02:41 · LAX 11:41 · JFK 14:41
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.