Fix crash on startup
Add publishers.json to pip package Add exception handling to prevent crash
This commit is contained in:
parent
74d95b6a50
commit
1468b1932f
@ -275,4 +275,7 @@ publishers: dict[str, ImprintDict] = {}
|
||||
|
||||
|
||||
def load_publishers() -> None:
|
||||
update_publishers(json.loads((pathlib.Path(__file__).parent / "data" / "publishers.json").read_text("utf-8")))
|
||||
try:
|
||||
update_publishers(json.loads((pathlib.Path(__file__).parent / "data" / "publishers.json").read_text("utf-8")))
|
||||
except Exception:
|
||||
logger.exception("Failed to load publishers.json; The are no publishers or imprints loaded")
|
||||
|
@ -87,6 +87,10 @@ try:
|
||||
qt_exception_hook = UncaughtHook()
|
||||
from comictaggerlib.taggerwindow import TaggerWindow
|
||||
except ImportError as e:
|
||||
|
||||
def show_exception_box(log_msg: str):
|
||||
pass
|
||||
|
||||
logger.error(str(e))
|
||||
qt_available = False
|
||||
|
||||
@ -101,8 +105,9 @@ def update_publishers() -> None:
|
||||
if json_file.exists():
|
||||
try:
|
||||
utils.update_publishers(json.loads(json_file.read_text("utf-8")))
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
logger.exception("Failed to load publishers from %s", json_file)
|
||||
show_exception_box(str(e))
|
||||
|
||||
|
||||
def ctmain() -> None:
|
||||
|
2
setup.py
2
setup.py
@ -55,7 +55,7 @@ setup(
|
||||
url="https://github.com/comictagger/comictagger",
|
||||
packages=["comictaggerlib", "comicapi"],
|
||||
package_data={
|
||||
"comictaggerlib": ["ui/*", "graphics/*"],
|
||||
"comictaggerlib": ["ui/*", "graphics/*", "data/*"],
|
||||
},
|
||||
entry_points=dict(console_scripts=["comictagger=comictaggerlib.main:ctmain"]),
|
||||
classifiers=[
|
||||
|
Loading…
Reference in New Issue
Block a user