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:
|
try:
|
||||||
if not isinstance(src, unicode):
|
if not isinstance(src, unicode):
|
||||||
src = src.decode('utf-8')
|
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
|
exec src in options
|
||||||
except (SystemError, RuntimeError):
|
except:
|
||||||
try:
|
print 'Failed to parse options string:'
|
||||||
src = src.replace('PyQt' + '4', 'PyQt5')
|
print repr(src)
|
||||||
exec src in options
|
traceback.print_exc()
|
||||||
except:
|
|
||||||
print 'Failed to parse options string:'
|
|
||||||
print repr(src)
|
|
||||||
traceback.print_exc()
|
|
||||||
opts = OptionValues()
|
opts = OptionValues()
|
||||||
for pref in self.preferences:
|
for pref in self.preferences:
|
||||||
val = options.get(pref.name, pref.default)
|
val = options.get(pref.name, pref.default)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user