fix upgrade code

This commit is contained in:
Alex Yatskov 2018-05-06 19:04:53 -07:00
parent d33b4e0dc7
commit 570350b038

View File

@ -434,7 +434,7 @@ class AnkiConnect:
if response == QMessageBox.Yes: if response == QMessageBox.Yes:
try: try:
data = download(URL_UPGRADE) data = self.download(URL_UPGRADE)
path = os.path.splitext(__file__)[0] + '.py' path = os.path.splitext(__file__)[0] + '.py'
with open(path, 'w') as fp: with open(path, 'w') as fp:
fp.write(makeStr(data)) fp.write(makeStr(data))
@ -444,8 +444,9 @@ class AnkiConnect:
'Upgraded to the latest version, please restart Anki.' 'Upgraded to the latest version, please restart Anki.'
) )
return True return True
except: except Exception as e:
QMessageBox.critical(self.window(), 'AnkiConnect', 'Failed to download latest version.') QMessageBox.critical(self.window(), 'AnkiConnect', 'Failed to download latest version.')
raise e
return False return False