Add crash-safe launcher to mac_native.py: show dialog and write traceback to ~/media_episodes_viewer_error.log
Co-authored-by: Copilot <[email protected]>
This commit is contained in:
1 parent
4de3064dd1
commit
6505781139
1 file changed
+23
-1
+23
-1
@@ -160,4 +160,26 @@ def main():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
try:
|
||||||
|
main()
|
||||||
|
except Exception as e:
|
||||||
|
import traceback, sys, os
|
||||||
|
tb = traceback.format_exc()
|
||||||
|
# Try to show a GUI error dialog if possible
|
||||||
|
try:
|
||||||
|
import tkinter as _tk
|
||||||
|
from tkinter import messagebox as _mb
|
||||||
|
_root = _tk.Tk()
|
||||||
|
_root.withdraw()
|
||||||
|
_mb.showerror("Launch Error", f"Error starting app:\n{e}\n\nA log was written to ~/media_episodes_viewer_error.log")
|
||||||
|
_root.destroy()
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
# Always write traceback to a known file for debugging
|
||||||
|
try:
|
||||||
|
with open(os.path.expanduser('~/media_episodes_viewer_error.log'), 'w') as fh:
|
||||||
|
fh.write(tb)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
# Re-raise so py2app shows the launch error dialog as well
|
||||||
|
raise
|
||||||
Reference in new issue
Block a user