diff --git a/src/calibre/db/locking.py b/src/calibre/db/locking.py index df27bbbb25..cc006f65f5 100644 --- a/src/calibre/db/locking.py +++ b/src/calibre/db/locking.py @@ -13,6 +13,8 @@ from calibre.utils.config_base import tweaks class LockingError(RuntimeError): + is_locking_error = True + def __init__(self, msg, extra=None): RuntimeError.__init__(self, msg) self.locking_debug_msg = extra diff --git a/src/calibre/utils/formatter.py b/src/calibre/utils/formatter.py index 2fa5901dde..34eb06a089 100644 --- a/src/calibre/utils/formatter.py +++ b/src/calibre/utils/formatter.py @@ -515,8 +515,8 @@ class TemplateFormatter(string.Formatter): try: ans = self.evaluate(fmt, [], kwargs).strip() except Exception as e: -# if DEBUG: -# traceback.print_exc() + if DEBUG and getattr(e, 'is_locking_error', False): + traceback.print_exc() ans = error_value + ' ' + e.message return ans @@ -529,7 +529,7 @@ class ValidateFormatter(TemplateFormatter): def validate(self, x): from calibre.ebooks.metadata.book.base import Metadata - self.book = Metadata(''); + self.book = Metadata('') return self.vformat(x, [], {}) validation_formatter = ValidateFormatter()