From 7028895b2fec96424444de9e77c6a121ced74420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=9C=A3=E7=BF=94=C2=B2=E2=81=B0=E2=82=82?= =?UTF-8?q?=E2=82=81?= Date: Thu, 5 Dec 2024 22:24:59 +0800 Subject: [PATCH] fix back exist_ok --- uiautomator2/__init__.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/uiautomator2/__init__.py b/uiautomator2/__init__.py index 0bcc910..10d13c2 100644 --- a/uiautomator2/__init__.py +++ b/uiautomator2/__init__.py @@ -210,18 +210,14 @@ def push(self, src, dst: str, mode=0o644): """ self._dev.sync.push(src, dst, mode=mode) - def pull(self, src: str, dst: str, exist_ok: bool = False): + def pull(self, src: str, dst: str): """ Pull file from device to local """ - self._dev.sync.pull(src, dst, exist_ok) - - # FIXME: check if windows still need f.close - # with open(dst, 'wb') as f: - # shutil.copyfileobj(r.raw, f) - # if _mswindows: # FIXME: check hotfix windows file size zero bug - # f.close() - + try: + self._dev.sync.pull(src, dst, exist_ok=True) + except TypeError: + self._dev.sync.pull(src, dst) class _Device(_BaseClient): __orientation = ( # device orientation