xiaocong / uiautomator

Python wrapper of Android uiautomator test tool.
MIT License
2.03k stars 638 forks source link

OSSError: WinError 6 句柄无效 #213

Open kingname opened 7 years ago

kingname commented 7 years ago

Everything is ok when I use macOS to run the code. But when I use windows 10, the exception alway raised when I call an element's 'exists' property.

My Python is Python 3.6, both in macOS and WIndows 10.

The related code is:

search_icon_bar = self.device(text='Show', instance=0)
        if search_icon_bar.exists:`

Traceback (most recent call last):
  File "c:\python3\Lib\threading.py", line 916, in _bootstrap_inner
    self.run()
  File "C:\XX\ContributeSpider\Operator\UiOperator.py", line 142, in run
    self.operate_ui(start_time, task_start_time, host)
  File "C:\XX\ContributeSpider\Operator\UiOperator.py", line 175, in operate_ui
    if not self.operate_search(host):
  File "C:\XX\ContributeSpider\Operator\UiOperator.py", line 162, in operate_search
    if self.exception_revive(host):
  File "C:\XX\ContributeSpider\Operator\UiOperator.py", line 222, in exception_revive
    if self.restore_from_frontpage():
  File "C:\XX\ContributeSpider\Operator\UiOperator.py", line 296, in restore_from_frontpage
    if search_icon_bar.exists:
  File "C:\XX\venv\lib\site-packages\uiautomator\__init__.py", line 883, in exists
    return self.jsonrpc.exist(self.selector)
  File "C:\XX\venv\lib\site-packages\uiautomator\__init__.py", line 432, in wrapper
    server.start()
  File "C:\XX\venv\lib\site-packages\uiautomator\__init__.py", line 470, in start
    self.install()
  File "C:\XX\venv\lib\site-packages\uiautomator\__init__.py", line 405, in install
    self.adb.cmd("install", "-r -t", os.path.join(base_dir, apk)).wait()
  File "C:\XX\venv\lib\site-packages\uiautomator\__init__.py", line 283, in cmd
    return self.raw_cmd(*["-s", serial] + list(args))
  File "C:\XX\venv\lib\site-packages\uiautomator\__init__.py", line 292, in raw_cmd
    return subprocess.Popen(cmd_line, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "c:\python3\Lib\subprocess.py", line 594, in __init__
    _cleanup()
  File "c:\python3\Lib\subprocess.py", line 205, in _cleanup
    res = inst._internal_poll(_deadstate=sys.maxsize)
  File "c:\python3\Lib\subprocess.py", line 1025, in _internal_poll
    if _WaitForSingleObject(self._handle, 0) == _WAIT_OBJECT_0:
OSError: [WinError 6] 句柄无效。```
yanglikai0806 commented 7 years ago

my python3.6 also meets this issue, any way to resolve this ?

dktobeno1 commented 6 years ago

Have you resolved this?

kingname commented 6 years ago

no, so I use ubuntu to run my code.