sajmalyousef / webscraper-library

0 stars 2 forks source link

socket.error: [Errno 104] Connection reset by peer #2

Open daltonfury42 opened 8 years ago

daltonfury42 commented 8 years ago

As of now, when I try to run this program, I get this error:


shell~:./getBooksByPrice.py 
Traceback (most recent call last):
  File "./getBooksByPrice.py", line 64, in <module>
    lookup(query)
  File "./getBooksByPrice.py", line 12, in lookup
    browser = webdriver.Firefox() 
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 85, in __init__
    keep_alive=True)
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 90, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 177, in start_session
    response = self.execute(Command.NEW_SESSION, capabilities)
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 234, in execute
    response = self.command_executor.execute(driver_command, params)
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 401, in execute
    return self._request(command_info[0], url, body=data)
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 432, in _request
    resp = self._conn.getresponse()
  File "/usr/lib/python2.7/httplib.py", line 1136, in getresponse
    response.begin()
  File "/usr/lib/python2.7/httplib.py", line 453, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python2.7/httplib.py", line 409, in _read_status
    line = self.fp.readline(_MAXLINE + 1)
  File "/usr/lib/python2.7/socket.py", line 480, in readline
    data = self._sock.recv(self._rbufsize)
socket.error: [Errno 104] Connection reset by peer

Any idea why ad how to fix it?

sajmalyousef commented 8 years ago

Have you installed selenium? On 27-Jun-2016 9:51 pm, "daltonfury42" notifications@github.com wrote:

As of now, when I try to run this program, I get this error:

shell~:./getBooksByPrice.py Traceback (most recent call last): File "./getBooksByPrice.py", line 64, in lookup(query) File "./getBooksByPrice.py", line 12, in lookup browser = webdriver.Firefox() File "/usr/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 85, in init keep_alive=True) File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 90, in init self.start_session(desired_capabilities, browser_profile) File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 177, in start_session response = self.execute(Command.NEW_SESSION, capabilities) File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 234, in execute response = self.command_executor.execute(driver_command, params) File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 401, in execute return self._request(command_info[0], url, body=data) File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 432, in _request resp = self._conn.getresponse() File "/usr/lib/python2.7/httplib.py", line 1136, in getresponse response.begin() File "/usr/lib/python2.7/httplib.py", line 453, in begin version, status, reason = self._read_status() File "/usr/lib/python2.7/httplib.py", line 409, in _read_status line = self.fp.readline(_MAXLINE + 1) File "/usr/lib/python2.7/socket.py", line 480, in readline data = self._sock.recv(self._rbufsize) socket.error: [Errno 104] Connection reset by peer

Any idea why ad how to fix it?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sajmalyousef/webscraper-library/issues/2, or mute the thread https://github.com/notifications/unsubscribe/AMk_KiwYLGNXmQWkqA8p2yb8-VOQ0dZsks5qP_iMgaJpZM4I_RA3 .

daltonfury42 commented 8 years ago

Yes.

sajmalyousef commented 8 years ago

suppose you change the link within .get() ,then does it work?

daltonfury42 commented 8 years ago

Which line am I supposed to modify? I am getting all kinds of errors:

shell~:./getBooksByPrice.py 
Traceback (most recent call last):
  File "./getBooksByPrice.py", line 64, in <module>
    lookup(query)
  File "./getBooksByPrice.py", line 13, in lookup
    browser.get("https://www.indiabookstore.net/")
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 248, in get
    self.execute(Command.GET, {'url': url})
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 234, in execute
    response = self.command_executor.execute(driver_command, params)
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 401, in execute
    return self._request(command_info[0], url, body=data)
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 432, in _request
    resp = self._conn.getresponse()
  File "/usr/lib/python2.7/httplib.py", line 1136, in getresponse
    response.begin()
  File "/usr/lib/python2.7/httplib.py", line 453, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python2.7/httplib.py", line 417, in _read_status
    raise BadStatusLine(line)
httplib.BadStatusLine: ''

I think the best idea is for you to catch all these errors and write an appropriate error message. You don't want your program to crash in front of the customer, do you?

sajmalyousef commented 8 years ago

Please refer the readme.I have successfully run the code on another machine.