Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG - Connection lost #23

Closed
gvmturl opened this issue Jun 15, 2020 · 4 comments
Closed

BUG - Connection lost #23

gvmturl opened this issue Jun 15, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@gvmturl
Copy link
Collaborator

gvmturl commented Jun 15, 2020

Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 421, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 416, in _make_request
    httplib_response = conn.getresponse()
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\http\client.py", line 1336, in getresponse
    response.begin()
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\http\client.py", line 306, in begin
    version, status, reason = self._read_status()
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\http\client.py", line 267, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\socket.py", line 589, in readinto
    return self._sock.recv_into(b)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "insomniac.py", line 221, in <module>
    main()
  File "insomniac.py", line 49, in main
    _job_handle_bloggers(device, args.bloggers, int(args.likes_count), storage, on_interaction)
  File "insomniac.py", line 105, in _job_handle_bloggers
    raise e
  File "insomniac.py", line 89, in _job_handle_bloggers
    handle_blogger(device, blogger, likes_count, storage, _on_like, on_interaction)
  File "C:\Users\User\Downloads\Insomniac2\action_handle_blogger.py", line 18, in handle_blogger
    _iterate_over_followers(device, interaction, storage, on_interaction)
  File "C:\Users\User\Downloads\Insomniac2\action_handle_blogger.py", line 69, in _iterate_over_followers
    interaction_succeed = interaction(device)
  File "C:\Users\User\Downloads\Insomniac2\action_handle_blogger.py", line 109, in _interact_with_user
    if not _open_photo_and_like(device, row, column, on_like):
  File "C:\Users\User\Downloads\Insomniac2\action_handle_blogger.py", line 143, in _open_photo_and_like
    action_bar_bottom = action_bar.bounds['bottom']
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 934, in __getattr__
    info = self.info
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 945, in info
    return self.jsonrpc.objInfo(self.selector)
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 443, in wrapper
    return _JsonRPCMethod(url, method, timeout, False)(*args, **kwargs)
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 438, in wrapper
    return _method_obj(*args, **kwargs)
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 119, in __call__
    timeout=self.timeout)
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\poolmanager.py", line 330, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 720, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\util\retry.py", line 400, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\packages\six.py", line 735, in reraise
    raise value
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 672, in urlopen
    chunked=chunked,
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 423, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 331, in _raise_timeout
    self, url, "Read timed out. (read timeout=%s)" % timeout_value
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=9008): Read timed out. (read timeout=90)

We need something to bypass connection lost message and try again.

Thank you.

@gvmturl gvmturl changed the title ERROR - Connection lost BUG - Connection lost Jun 15, 2020
@alexal1
Copy link
Owner

alexal1 commented Jun 15, 2020

Why did disconnection actually happen? Are you connected via cable or wifi? Maybe you touched the cable before disconnection happened or maybe it's damaged?

@alexal1 alexal1 added the bug Something isn't working label Jun 15, 2020
@gvmturl
Copy link
Collaborator Author

gvmturl commented Jun 15, 2020

Intermittent Wi-Fi connection.

@gvmturl
Copy link
Collaborator Author

gvmturl commented Jun 17, 2020

Have to catch it and retry after a delay. This is the general strategy for handling RequestTimeouts.

try: #something except (ConnectionError, ReadTimeout): print(INTERNET_DOWN_MSG)

Or something like that:

try: #something except requests.exceptions.Timeout: print “Timeout occurred”

@alexal1
Copy link
Owner

alexal1 commented Jun 19, 2020

I catch timeout exception already. The script had to start current blogger from the beginning after this crash, did it?

@gvmturl gvmturl closed this as completed Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants