mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Handle not being able to decode plugin loading failure exceptions
This commit is contained in:
parent
55e8d547af
commit
86f972cde1
@ -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 @@ class Plugins(collections.Mapping):
|
||||
p = importlib.import_module(name)
|
||||
except Exception as err:
|
||||
p = None
|
||||
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…
x
Reference in New Issue
Block a user