openatx / adbutils

pure python adb library for google adb service.
MIT License
736 stars 173 forks source link

Address already in use #85

Open SmartManoj opened 1 year ago

SmartManoj commented 1 year ago

Need to adb kill-server

Traceback:

File "/home/smart/.local/lib/python3.10/site-packages/uiautomator2/_selector.py", line 360, in get_text
    self.must_wait(timeout=timeout)
  File "/home/smart/.local/lib/python3.10/site-packages/uiautomator2/_selector.py", line 344, in must_wait
    if not self.wait(exists, timeout):
  File "/home/smart/.local/lib/python3.10/site-packages/uiautomator2/_selector.py", line 314, in wait
    return self.jsonrpc.waitForExists(self.selector,
  File "/home/smart/.local/lib/python3.10/site-packages/uiautomator2/__init__.py", line 481, in __call__
    return self.server._jsonrpc_retry_call(self.method, params,
  File "/home/smart/.local/lib/python3.10/site-packages/uiautomator2/__init__.py", line 488, in _jsonrpc_retry_call
    return self._jsonrpc_call(*args, **kwargs)
  File "/home/smart/.local/lib/python3.10/site-packages/uiautomator2/__init__.py", line 514, in _jsonrpc_call
    res = self.http.post("/jsonrpc/0",
  File "/home/smart/.local/lib/python3.10/site-packages/requests/sessions.py", line 635, in post
    return self.request("POST", url, data=data, json=json, **kwargs)
  File "/home/smart/.local/lib/python3.10/site-packages/uiautomator2/__init__.py", line 202, in request
    url = self.__client.path2url(url)
  File "/home/smart/.local/lib/python3.10/site-packages/uiautomator2/__init__.py", line 301, in path2url
    return urlparse.urljoin(self._get_atx_agent_url(), path)
  File "/home/smart/.local/lib/python3.10/site-packages/uiautomator2/__init__.py", line 282, in _get_atx_agent_url
    lport = self._adb_device.forward_port(
  File "/home/smart/.local/lib/python3.10/site-packages/adbutils/_device.py", line 236, in forward_port
    local_port = get_free_port()
  File "/home/smart/.local/lib/python3.10/site-packages/adbutils/_utils.py", line 26, in get_free_port
    s.bind(('127.0.0.1', 0))
OSError: [Errno 98] Address already in use
codeskyblue commented 1 year ago

What kind system are you using @SmartManoj I'm using this way to pick random port https://stackoverflow.com/questions/1365265/on-localhost-how-do-i-pick-a-free-port-number

SmartManoj commented 1 year ago

Manjaro XFCE 21.3.7

codeskyblue commented 1 year ago

https://github.com/openatx/adbutils/commit/5c1266f4b53217ba5f74391b389b7cf62cd76394

Try to update adbutils to 1.2.3