diff --git a/gapi/drive_api.py b/gapi/drive_api.py index 2a33d85..1fdd2a7 100644 --- a/gapi/drive_api.py +++ b/gapi/drive_api.py @@ -36,14 +36,14 @@ class drive_api(API): self.fill_in(parent) parent = parent[sub] end = path[-1] - try: - return parent[end] - except KeyError: - self.fill_in(parent) - try: - return parent[end] - except KeyError: - raise FileNotFoundError() + for _try in range(2): + try: + return parent[end] + except KeyError: + if _try == 0: + self.fill_in(parent) + else: + raise FileNotFoundError() # finds all files and folders from a parent def fill_in(self,parent):