close

今天在跑例行更新的爬蟲時

發現了這個問題

我用的是 chromedriver + selenium

 

Traceback (most recent call last):

  File "/Users/yanzewei/Documents/PythonProjects/ig_parser/Updata_all_ig_img", line 463, in <module>

    runInOneAccount(accObj.getAccount(), accObj.getLimitation())

  File "/Users/yanzewei/Documents/PythonProjects/ig_parser/Updata_all_ig_img", line 354, in runInOneAccount

    driver.get(source_url)

  File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 320, in get

    self.execute(Command.GET, {'url': url})

  File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 306, in execute

    response = self.command_executor.execute(driver_command, params)

  File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 460, in execute

    return self._request(command_info[0], url, body=data)

  File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 484, in _request

    resp = self._conn.getresponse()

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1132, in getresponse

    response.begin()

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 453, in begin

    version, status, reason = self._read_status()

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 417, in _read_status

    raise BadStatusLine(line)

httplib.BadStatusLine: ''

 

這時候就疑惑了

明明程式碼都沒修改,怎麼突然會發生這種事呢?

檢查了 web 的 element 有沒有變動,X-Path 是不是正確之後

才到 google 尋求解答

經歷一番「走錯路」後,才發現原因

其實是 Chromedriver 的版本太舊了

更新一下就順利 work 了。

 

Chromedriver 更新網址如下
http://chromedriver.chromium.org/

 

 


arrow
arrow
    文章標籤
    Python
    全站熱搜
    創作者介紹
    創作者 顏澤偉 的頭像
    顏澤偉

    Willy's Fish教學筆記』

    顏澤偉 發表在 痞客邦 留言(0) 人氣()