mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
More robust fix for handling of .py config files with pickled QByteArray instances
This commit is contained in:
parent
4106a4b0d1
commit
69af8a9b65
@ -193,16 +193,12 @@ class OptionSet(object):
|
||||
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…
x
Reference in New Issue
Block a user