mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Prevent import of PyQt4 with an ImportError
This commit is contained in:
parent
12f30851e0
commit
44b77cdb85
@ -24,6 +24,18 @@ winutil = winutilerror = None
|
|||||||
if not _run_once:
|
if not _run_once:
|
||||||
_run_once = True
|
_run_once = True
|
||||||
|
|
||||||
|
# Prevent PyQt4 from being loaded
|
||||||
|
class PyQt4Ban(object):
|
||||||
|
|
||||||
|
def find_module(self, fullname, path=None):
|
||||||
|
if fullname.startswith('PyQt4'):
|
||||||
|
return self
|
||||||
|
|
||||||
|
def load_module(self, fullname):
|
||||||
|
raise ImportError('Importing PyQt4 is not allowed as calibre uses PyQt5')
|
||||||
|
|
||||||
|
sys.meta_path.insert(0, PyQt4Ban())
|
||||||
|
|
||||||
#
|
#
|
||||||
# Platform specific modules
|
# Platform specific modules
|
||||||
if iswindows:
|
if iswindows:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user