dump error on profile load fail

may help diagnose
https://forums.ankiweb.net/t/i-couldnt-open-anki-resetting-corrupt-global/190
This commit is contained in:
Damien Elmes 2020-07-02 10:35:01 +10:00
parent 04b1ca7559
commit 48b6510aef

View file

@ -11,6 +11,7 @@ import locale
import pickle import pickle
import random import random
import shutil import shutil
import traceback
from typing import Any, Dict, List, Optional from typing import Any, Dict, List, Optional
from send2trash import send2trash from send2trash import send2trash
@ -134,6 +135,7 @@ class ProfileManager:
except AnkiRestart: except AnkiRestart:
raise raise
except: except:
print("migration failed")
self.base = newBase self.base = newBase
shutil.move(oldBase, self.base) shutil.move(oldBase, self.base)
@ -253,7 +255,7 @@ Anki could not read your profile data. Window sizes and your sync login \
details have been forgotten.""" details have been forgotten."""
), ),
) )
traceback.print_stack()
print("resetting corrupt profile") print("resetting corrupt profile")
self.profile = profileConf.copy() self.profile = profileConf.copy()
self.save() self.save()
@ -442,6 +444,7 @@ create table if not exists profiles
"select cast(data as blob) from profiles where name = '_global'" "select cast(data as blob) from profiles where name = '_global'"
) )
except: except:
traceback.print_stack()
if result.loadError: if result.loadError:
# already failed, prevent infinite loop # already failed, prevent infinite loop
raise raise
@ -455,6 +458,7 @@ create table if not exists profiles
self.meta = self._unpickle(data) self.meta = self._unpickle(data)
return result return result
except: except:
traceback.print_stack()
print("resetting corrupt _global") print("resetting corrupt _global")
result.loadError = True result.loadError = True
result.firstTime = True result.firstTime = True