py3 compat: fix error when chaning search the net urls for content server

This commit is contained in:
Kovid Goyal 2021-06-01 15:32:31 +05:30
parent 28b551080b
commit 23d626e966
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -1169,7 +1169,7 @@ class SearchTheInternet(QWidget):
cu = self.current_urls cu = self.current_urls
if cu: if cu:
with lopen(search_the_net_urls.path, 'wb') as f: with lopen(search_the_net_urls.path, 'wb') as f:
f.write(self.serialized_urls) f.write(self.serialized_urls.encode('utf-8'))
else: else:
try: try:
os.remove(search_the_net_urls.path) os.remove(search_the_net_urls.path)
@ -1184,7 +1184,7 @@ class SearchTheInternet(QWidget):
filters=[(_('URL files'), ['json'])], initial_filename='search-urls.json') filters=[(_('URL files'), ['json'])], initial_filename='search-urls.json')
if path: if path:
with lopen(path, 'wb') as f: with lopen(path, 'wb') as f:
f.write(self.serialized_urls) f.write(self.serialized_urls.encode('utf-8'))
def import_urls(self): def import_urls(self):
paths = choose_files(self, 'search-net-urls', _('Choose URLs file'), paths = choose_files(self, 'search-net-urls', _('Choose URLs file'),