mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 03:13:36 +02:00
More robust fix for handling of .py config files with pickled QByteArray instances
This commit is contained in:
parent
4106a4b0d1
commit
69af8a9b65
1 changed files with 5 additions and 9 deletions
|
|
@ -193,16 +193,12 @@ def parse_string(self, src):
|
|||
try:
|
||||
if not isinstance(src, unicode):
|
||||
src = src.decode('utf-8')
|
||||
src = src.replace(u'PyQt5.QtCore', u'PyQt4.QtCore')
|
||||
src = src.replace(u'PyQt4.QtCore', u'PyQt5.QtCore')
|
||||
exec src in options
|
||||
except (SystemError, RuntimeError):
|
||||
try:
|
||||
src = src.replace('PyQt' + '4', 'PyQt5')
|
||||
exec src in options
|
||||
except:
|
||||
print 'Failed to parse options string:'
|
||||
print repr(src)
|
||||
traceback.print_exc()
|
||||
except:
|
||||
print 'Failed to parse options string:'
|
||||
print repr(src)
|
||||
traceback.print_exc()
|
||||
opts = OptionValues()
|
||||
for pref in self.preferences:
|
||||
val = options.get(pref.name, pref.default)
|
||||
|
|
|
|||
Loading…
Reference in a new issue