mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Get proper unicode printouts from the unhandled exception handler
This commit is contained in:
parent
e7e78da5c1
commit
1b1d51b078
@ -10,8 +10,8 @@ from PyQt5.Qt import (QMainWindow, QTimer, QAction, QMenu, QMenuBar, QIcon,
|
|||||||
QObject)
|
QObject)
|
||||||
from calibre.utils.config import OptionParser
|
from calibre.utils.config import OptionParser
|
||||||
from calibre.gui2 import error_dialog
|
from calibre.gui2 import error_dialog
|
||||||
from calibre import prints, force_unicode, as_unicode
|
from calibre import prints, as_unicode
|
||||||
from polyglot.io import PolyglotBytesIO
|
from polyglot.io import PolyglotStringIO
|
||||||
|
|
||||||
|
|
||||||
def option_parser(usage='''\
|
def option_parser(usage='''\
|
||||||
@ -134,7 +134,7 @@ class MainWindow(QMainWindow):
|
|||||||
return
|
return
|
||||||
import traceback
|
import traceback
|
||||||
try:
|
try:
|
||||||
sio = PolyglotBytesIO(errors='replace')
|
sio = PolyglotStringIO(errors='replace')
|
||||||
try:
|
try:
|
||||||
from calibre.debug import print_basic_debug_info
|
from calibre.debug import print_basic_debug_info
|
||||||
print_basic_debug_info(out=sio)
|
print_basic_debug_info(out=sio)
|
||||||
@ -144,11 +144,10 @@ class MainWindow(QMainWindow):
|
|||||||
if getattr(value, 'locking_debug_msg', None):
|
if getattr(value, 'locking_debug_msg', None):
|
||||||
prints(value.locking_debug_msg, file=sio)
|
prints(value.locking_debug_msg, file=sio)
|
||||||
fe = sio.getvalue()
|
fe = sio.getvalue()
|
||||||
prints(fe, file=sys.stderr)
|
|
||||||
fe = force_unicode(fe)
|
|
||||||
msg = '<b>%s</b>:'%exc_type.__name__ + as_unicode(value)
|
msg = '<b>%s</b>:'%exc_type.__name__ + as_unicode(value)
|
||||||
error_dialog(self, _('Unhandled exception'), msg, det_msg=fe,
|
error_dialog(self, _('Unhandled exception'), msg, det_msg=fe,
|
||||||
show=True)
|
show=True)
|
||||||
|
prints(fe, file=sys.stderr)
|
||||||
except BaseException:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
except:
|
except:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user