codeskyblue / tidevice3

wrapper for pymobiledevice3 to make it more easy to use.
MIT License
176 stars 33 forks source link

pipx安装的tidevice3库,在执行启动app的命令时,报错Future <Future pending> attached to a different loop,而pip安装的库则不会报错 #22

Open 2088669827 opened 3 months ago

2088669827 commented 3 months ago

执行命令:t3 -u 00008120-001C4C5E3E98A01E app launch com.krunner.kwda2时,会正常输出pid,但是后面会紧跟输出asyncio 异步的问题,而且这种情况只出现在使用pipx安装的tidevice3,如果用pip工具安装,则不会出现,这是为什么呢?

Process launched with pid 1157 unhandled exception: Task <Task pending name='Task-2' coro=<RemoteServiceDiscoveryService.close() running at /Users/shop5/.local/pipx/venvs/tidevice3/lib/python3.12/site-packages/pymobiledevice3/remote/remote_service_discovery.py:116> cb=[_run_until_complete_cb() at /opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py:182]> got Future attached to a different loop Traceback (most recent call last): File "/Users/shop5/.local/pipx/venvs/tidevice3/lib/python3.12/site-packages/tidevice3/main.py", line 20, in main cli(auto_envvar_prefix='T3') File "/Users/shop5/.local/pipx/venvs/tidevice3/lib/python3.12/site-packages/click/core.py", line 1157, in call return self.main(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/shop5/.local/pipx/venvs/tidevice3/lib/python3.12/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/Users/shop5/.local/pipx/venvs/tidevice3/lib/python3.12/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/shop5/.local/pipx/venvs/tidevice3/lib/python3.12/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/shop5/.local/pipx/venvs/tidevice3/lib/python3.12/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/shop5/.local/pipx/venvs/tidevice3/lib/python3.12/site-packages/click/core.py", line 783, in invoke return __callback(args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/shop5/.local/pipx/venvs/tidevice3/lib/python3.12/site-packages/click/decorators.py", line 33, in new_func return f(get_current_context(), args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/shop5/.local/pipx/venvs/tidevice3/lib/python3.12/site-packages/tidevice3/cli/cli_common.py", line 54, in new_func with service_provider: File "/Users/shop5/.local/pipx/venvs/tidevice3/lib/python3.12/site-packages/tidevice3/api.py", line 96, in exit get_asyncio_loop().run_until_complete(self.close()) File "/opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "/Users/shop5/.local/pipx/venvs/tidevice3/lib/python3.12/site-packages/pymobiledevice3/remote/remote_service_discovery.py", line 116, in close await self.service.close() File "/Users/shop5/.local/pipx/venvs/tidevice3/lib/python3.12/site-packages/pymobiledevice3/remote/remotexpc.py", line 61, in close await self.service_connection.aio_close() File "/Users/shop5/.local/pipx/venvs/tidevice3/lib/python3.12/site-packages/pymobiledevice3/service_connection.py", line 108, in aio_close await self.writer.wait_closed() File "/opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/streams.py", line 364, in wait_closed await self._protocol._get_close_waiter(self) RuntimeError: Task <Task pending name='Task-2' coro=<RemoteServiceDiscoveryService.close() running at /Users/shop5/.local/pipx/venvs/tidevice3/lib/python3.12/site-packages/pymobiledevice3/remote/remote_service_discovery.py:116> cb=[_run_until_complete_cb() at /opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py:182]> got Future attached to a different loop

lingling-fa commented 3 months ago

我使用pip安装的也有一模一样的错误,之前没有出现过这错误。(我是在python3.10创建的虚拟环境)

2088669827 commented 3 months ago

经过多次实验,我发现是因为安装tidevice3的0.11.3版本时,默认安装pymobiledevice3的4.7.2版本,把pymobiledevice3的版本降为4.3.1,就不会再出现这个报错了