diff options
| author | Marc Abonce Seguin <marc-abonce@mailbox.org> | 2018-01-16 23:05:18 -0600 |
|---|---|---|
| committer | Marc Abonce Seguin <marc-abonce@mailbox.org> | 2018-01-16 23:26:10 -0600 |
| commit | 829032f306cec8f6d109bfb037a01dc50ff87442 (patch) | |
| tree | 38b9bbabbdfc6a343be30ccdc519643ee6fccdc3 /searx/engines | |
| parent | 5947c0564966a791709c855fa2fb01af984c86dc (diff) | |
[fix] read utf-8 files (settings, languages, currency) with python3.5
Related to discussion in #1124
The io.open import is necessary for python2
Diffstat (limited to 'searx/engines')
| -rw-r--r-- | searx/engines/__init__.py | 3 | ||||
| -rw-r--r-- | searx/engines/currency_convert.py | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/searx/engines/__init__.py b/searx/engines/__init__.py index bec8de3a8..b4479157b 100644 --- a/searx/engines/__init__.py +++ b/searx/engines/__init__.py @@ -19,6 +19,7 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >. import sys import threading from os.path import realpath, dirname +from io import open from flask_babel import gettext from operator import itemgetter from json import loads @@ -36,7 +37,7 @@ engines = {} categories = {'general': []} -languages = loads(open(engine_dir + '/../data/engines_languages.json', 'rb').read()) +languages = loads(open(engine_dir + '/../data/engines_languages.json', 'r', encoding='utf-8').read()) engine_shortcuts = {} engine_default_args = {'paging': False, diff --git a/searx/engines/currency_convert.py b/searx/engines/currency_convert.py index 34a9af678..9c1c2f7b3 100644 --- a/searx/engines/currency_convert.py +++ b/searx/engines/currency_convert.py @@ -4,6 +4,7 @@ import os import sys import unicodedata +from io import open from datetime import datetime if sys.version_info[0] == 3: @@ -94,7 +95,7 @@ def load(): global db current_dir = os.path.dirname(os.path.realpath(__file__)) - json_data = open(current_dir + "/../data/currencies.json", 'rb').read() + json_data = open(current_dir + "/../data/currencies.json", 'r', encoding='utf-8').read() db = json.loads(json_data) |