From a1b4563f415e1dabce9e7ee6c8b3ab6c640aee2f Mon Sep 17 00:00:00 2001 From: Nikhil Badyal Date: Thu, 10 Aug 2023 22:07:40 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Try=20to=20open=20file=20instead?= =?UTF-8?q?=20of=20checking?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/patches.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/patches.py b/src/patches.py index 6161229..e7a0cda 100644 --- a/src/patches.py +++ b/src/patches.py @@ -1,6 +1,5 @@ """Revanced Patches.""" import json -import os from typing import Any, Dict, List, Tuple from loguru import logger @@ -66,11 +65,12 @@ class Patches(object): def scrap_patches(self, file_name: str) -> Any: """Scrap Patches.""" - if os.path.exists(file_name): + try: with open(file_name) as f: patches = json.load(f) return patches - raise PatchesJsonFailed() + except FileNotFoundError: + raise PatchesJsonFailed() # noinspection DuplicatedCode def fetch_patches(self, config: RevancedConfig, app: APP) -> None: