mirror of
https://github.com/noDRM/DeDRM_tools
synced 2024-12-27 21:59:11 +01:00
Use open instead of file() to export keys to file.
Fixes export of Kindle keys in calibre 5.0.1 here.
This commit is contained in:
parent
ff8d44492e
commit
9df1563492
1 changed files with 4 additions and 4 deletions
|
@ -431,15 +431,15 @@ class ManageKeysDialog(QDialog):
|
||||||
defaultname = "{0}.{1}".format(keyname, self.keyfile_ext)
|
defaultname = "{0}.{1}".format(keyname, self.keyfile_ext)
|
||||||
filename = choose_save_file(self, unique_dlg_name, caption, filters, all_files=False, initial_filename=defaultname)
|
filename = choose_save_file(self, unique_dlg_name, caption, filters, all_files=False, initial_filename=defaultname)
|
||||||
if filename:
|
if filename:
|
||||||
with file(filename, 'wb') as fname:
|
with open(filename, 'wb') as fname:
|
||||||
if self.binary_file:
|
if self.binary_file:
|
||||||
fname.write(self.plugin_keys[keyname].decode('hex'))
|
fname.write(self.plugin_keys[keyname].decode('hex'))
|
||||||
elif self.json_file:
|
elif self.json_file:
|
||||||
fname.write(json.dumps(self.plugin_keys[keyname]))
|
fname.write(json.dumps(self.plugin_keys[keyname]).encode())
|
||||||
elif self.android_file:
|
elif self.android_file:
|
||||||
for key in self.plugin_keys[keyname]:
|
for key in self.plugin_keys[keyname]:
|
||||||
fname.write(key)
|
fname.write(key.encode())
|
||||||
fname.write("\n")
|
fname.write(b"\n")
|
||||||
else:
|
else:
|
||||||
fname.write(self.plugin_keys[keyname])
|
fname.write(self.plugin_keys[keyname])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue