From 5de0819c150eecf883f45f90747d48efc247bc32 Mon Sep 17 00:00:00 2001 From: lilly Date: Thu, 23 Mar 2023 23:36:13 +0900 Subject: [PATCH] some change logic --- mypath.py | 9 ++++++--- wildcards.py | 3 +-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/mypath.py b/mypath.py index 1094217..dafa465 100644 --- a/mypath.py +++ b/mypath.py @@ -48,7 +48,7 @@ print("os.path.abspath(sys.modules\['__main__'].__file__) : " + mainFile ,style= mainfolder = os.path.dirname(mainFile) print("os.path.dirname(mainFile) : " + mainfolder , style="bold CYAN") -def jsondic(full,dic): +def jsondic(full,dic,update=False): path=os.path.split(full)[0] if not os.path.exists(path): @@ -56,8 +56,11 @@ def jsondic(full,dic): #with open(f"./RandomLoop/chars-{time.strftime('_%Y%m%d_%H%M%S')}.json", 'w', encoding='utf-8') as file: if os.path.exists(full): with open(full, 'r', encoding='utf-8') as file: - dic=json.load(file) - #print(dic) + tmp=json.load(file) + if update: + dic.update(tmp) + else: + dic=(tmp) else: with open(full, 'w', encoding='utf-8') as file: json.dump(dic, file, sort_keys=False, indent=4) diff --git a/wildcards.py b/wildcards.py index a17c07f..30a4d03 100644 --- a/wildcards.py +++ b/wildcards.py @@ -78,8 +78,7 @@ class wildcards: except Exception as e: - print(f"Error : {match.groups()}" ,Colors.YELLOW) - print(f"Exception : {e}" ,Colors.YELLOW) + console.print_exception() return ""