From 73709f7c008023f254ccc706ab98edc9b4a201f9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 29 Oct 2014 08:36:25 +0530 Subject: [PATCH] Make more details available in the error message when failing to start calibre because another instance is running --- src/calibre/gui2/main.py | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index 793feb825c..8c9160bb9d 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -374,22 +374,21 @@ def run_gui(opts, args, listener, app, gui_debug=None): return ret def cant_start(msg=_('If you are sure it is not running')+', ', - what=None): + det_msg=_('Timed out waiting for response from running calibre')): base = '

%s

%s %s' where = __appname__ + ' '+_('may be running in the system tray, in the')+' ' if isosx: where += _('upper right region of the screen.') else: where += _('lower right region of the screen.') - if what is None: - if iswindows or islinux: - what = _('try rebooting your computer.') - else: - what = _('try deleting the file')+': '+ gui_socket_address() + if iswindows or islinux: + what = _('try rebooting your computer.') + else: + what = _('try deleting the file')+': '+ gui_socket_address() info = base%(where, msg, what) error_dialog(None, _('Cannot Start ')+__appname__, - '

'+(_('%s is already running.')%__appname__)+'

'+info, show=True) + '

'+(_('%s is already running.')%__appname__)+'

'+info, det_msg=det_msg, show=True) raise SystemExit(1) @@ -398,11 +397,7 @@ def build_pipe(print_error=True): t.start() t.join(3.0) if t.is_alive(): - if iswindows: - cant_start() - else: - f = os.path.expanduser('~/.calibre_calibre GUI.lock') - cant_start(what=_('try deleting the file')+': '+f) + cant_start() raise SystemExit(1) return t @@ -460,13 +455,13 @@ def main(args=sys.argv): listener = create_listener() except socket.error: if iswindows or islinux: - cant_start() + cant_start(det_msg=traceback.format_exc()) if os.path.exists(gui_socket_address()): os.remove(gui_socket_address()) try: listener = create_listener() except socket.error: - cant_start() + cant_start(det_msg=traceback.format_exc()) else: return run_gui(opts, args, listener, app, gui_debug=gui_debug)