mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix importing of C-extensions when people are running from source with a PYTHONPATH containing conflicting pre-imported modules
This commit is contained in:
parent
327abb0ce8
commit
abda001fcf
@ -160,6 +160,10 @@ class Plugins(collections.Mapping):
|
|||||||
if name in self._plugins:
|
if name in self._plugins:
|
||||||
return
|
return
|
||||||
sys.path.insert(0, sys.extensions_location)
|
sys.path.insert(0, sys.extensions_location)
|
||||||
|
try:
|
||||||
|
del sys.modules[name]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
try:
|
try:
|
||||||
p, err = importlib.import_module(name), ''
|
p, err = importlib.import_module(name), ''
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user