2019丶04丶01 发表于 2022-5-26 10:10:09

python控制手机为什么报错

源码如下:
import uiautomator2 as u2

device = u2.connect('http://192.168.1.5')

print(device.device_info)


报错:E:\pythonProject\Scripts\python.exe "E:/python file/deivce-1.py"
Traceback (most recent call last):
File "E:\python file\deivce-1.py", line 5, in <module>
    print(device.device_info)
File "E:\python3.10\lib\site-packages\cached_property.py", line 36, in __get__
    value = obj.__dict__ = self.func(obj)
File "E:\python3.10\lib\site-packages\uiautomator2\__init__.py", line 883, in device_info
    return self.http.get("/info").json()
File "E:\python3.10\lib\site-packages\requests\sessions.py", line 542, in get
    return self.request('GET', url, **kwargs)
File "E:\python3.10\lib\site-packages\uiautomator2\__init__.py", line 215, in request
    raise OSError(
OSError: http-request to atx-agent error, can only recover from USB
请问下如何修改呢

suchocolate 发表于 2022-5-27 00:11:04

软件问题吧,python连不上手机这是。
页: [1]
查看完整版本: python控制手机为什么报错