try/except for getting version
This commit is contained in:
@@ -27,8 +27,12 @@ if not os.path.exists(launcherfiles):
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
urllib.request.urlretrieve(appslisturl, launcherfiles + "apps.json")
|
urllib.request.urlretrieve(appslisturl, launcherfiles + "apps.json")
|
||||||
|
|
||||||
|
try:
|
||||||
with open(launcherfiles + "/v") as v_file:
|
with open(launcherfiles + "/v") as v_file:
|
||||||
v = int(v_file.read())
|
v = int(v_file.read())
|
||||||
|
except:
|
||||||
|
v = -1
|
||||||
|
|
||||||
if v < int(requests.get(launcherversionurl).text):
|
if v < int(requests.get(launcherversionurl).text):
|
||||||
urllib.request.urlretrieve(launcherurl, "KOTIKOT_launcher.py")
|
urllib.request.urlretrieve(launcherurl, "KOTIKOT_launcher.py")
|
||||||
urllib.request.urlretrieve(guiurl, launcherfiles + "KOTIKOTlauncherMain.py")
|
urllib.request.urlretrieve(guiurl, launcherfiles + "KOTIKOTlauncherMain.py")
|
||||||
@@ -82,8 +86,11 @@ def launchApp():
|
|||||||
download_app(app)
|
download_app(app)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
with open(directory + "/v") as v_file:
|
with open(directory + "/v") as v_file:
|
||||||
v = int(v_file.read())
|
v = int(v_file.read())
|
||||||
|
except:
|
||||||
|
v = -1
|
||||||
if v < int(requests.get('/'.join(app['urls'][0].split('/')[:-1]) + '/v').text):
|
if v < int(requests.get('/'.join(app['urls'][0].split('/')[:-1]) + '/v').text):
|
||||||
print('Current app version is ' + str(v) + ' and new version is '
|
print('Current app version is ' + str(v) + ' and new version is '
|
||||||
+ requests.get('/'.join(app['urls'][0].split('/')[:-1]) + '/v').text)
|
+ requests.get('/'.join(app['urls'][0].split('/')[:-1]) + '/v').text)
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
0
|
1
|
||||||
Reference in New Issue
Block a user