From e2f0ae85741b664809d2d8a7fbaaf61ab98d524e Mon Sep 17 00:00:00 2001 From: BarsTiger Date: Fri, 18 Mar 2022 22:19:12 +0200 Subject: [PATCH] Ignore exceptions --- KOTIKOT_launcher.py | 49 +++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/KOTIKOT_launcher.py b/KOTIKOT_launcher.py index 0746d9c..af00092 100644 --- a/KOTIKOT_launcher.py +++ b/KOTIKOT_launcher.py @@ -63,33 +63,34 @@ def download_app(app): def launchApp(): - with open("OfficialProjects/LAUNCHERFILES/apps.json") as appsfile: - apps = json.load(appsfile) - name = KOTIKOTlauncher.sender().text() - app = apps[name] - directory = offprojects + app['dir'] + try: + with open("OfficialProjects/LAUNCHERFILES/apps.json") as appsfile: + apps = json.load(appsfile) + name = KOTIKOTlauncher.sender().text() + app = apps[name] + directory = offprojects + app['dir'] - if not os.path.exists(directory): - os.mkdir(directory) - download_app(app) - - else: - with open(directory + "/v") as v_file: - v = int(v_file.read()) - if v < int(requests.get('/'.join(app['urls'][0].split('/')[:-1]) + '/v').text): - print('Current app version is ' + str(v) + ' and new version is ' - + requests.get('/'.join(app['urls'][0].split('/')[:-1]) + '/v').text) - print('Updating...') + if not os.path.exists(directory): + os.mkdir(directory) download_app(app) - urllib.request.urlretrieve('/'.join(app['urls'][0].split('/')[:-1]) + '/v', - offprojects + app['dir'] + "/v") - displayName = name.replace('\n', '') - print(f"---------------- {displayName} ----------------") - subprocess.Popen(str(sys.executable + " " if app['runtime'] == "python" else "") + app['run'], cwd=directory, - shell=True, close_fds=True) - if not app['window']: - KOTIKOTreminder.show() + else: + with open(directory + "/v") as v_file: + v = int(v_file.read()) + if v < int(requests.get('/'.join(app['urls'][0].split('/')[:-1]) + '/v').text): + print('Current app version is ' + str(v) + ' and new version is ' + + requests.get('/'.join(app['urls'][0].split('/')[:-1]) + '/v').text) + print('Updating...') + download_app(app) + urllib.request.urlretrieve('/'.join(app['urls'][0].split('/')[:-1]) + '/v', + offprojects + app['dir'] + "/v") + + displayName = name.replace('\n', '') + print(f"---------------- {displayName} ----------------") + subprocess.Popen(str(sys.executable + " " if app['runtime'] == "python" else "") + app['run'], cwd=directory, + shell=True, close_fds=True) + except: + pass # ---------------- Checking buttons ----------------