mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-22 17:55:57 +01:00
Handle not being able to decode plugin loading failure exceptions
This commit is contained in:
parent
55e8d547af
commit
86f972cde1
1 changed files with 5 additions and 2 deletions
|
|
@ -2,7 +2,7 @@
|
|||
# vim:fileencoding=utf-8
|
||||
# License: GPLv3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
from __future__ import print_function, unicode_literals
|
||||
from polyglot.builtins import map, unicode_type, environ_item, hasenv, getenv
|
||||
from polyglot.builtins import map, unicode_type, environ_item, hasenv, getenv, as_unicode, native_string_type
|
||||
import sys, locale, codecs, os, importlib, collections
|
||||
|
||||
__appname__ = 'calibre'
|
||||
|
|
@ -213,7 +213,10 @@ def load_plugin(self, name):
|
|||
p = importlib.import_module(name)
|
||||
except Exception as err:
|
||||
p = None
|
||||
plugin_err = unicode_type(err)
|
||||
try:
|
||||
plugin_err = unicode_type(err)
|
||||
except Exception:
|
||||
plugin_err = as_unicode(native_string_type(err), encoding=preferred_encoding, errors='replace')
|
||||
self._plugins[name] = p, plugin_err
|
||||
sys.path.remove(plugins_loc)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue