forked from zaclys/searxng
Merge pull request #1148 from MarcAbonce/python3.5-fix
[fix] Read utf-8 files (settings, languages, currency) with Python3.5
This commit is contained in:
commit
4ad5e6ad4f
|
@ -9,6 +9,7 @@ addons:
|
||||||
language: python
|
language: python
|
||||||
python:
|
python:
|
||||||
- "2.7"
|
- "2.7"
|
||||||
|
- "3.5"
|
||||||
- "3.6"
|
- "3.6"
|
||||||
before_install:
|
before_install:
|
||||||
- "export DISPLAY=:99.0"
|
- "export DISPLAY=:99.0"
|
||||||
|
|
|
@ -19,6 +19,7 @@ import certifi
|
||||||
import logging
|
import logging
|
||||||
from os import environ
|
from os import environ
|
||||||
from os.path import realpath, dirname, join, abspath, isfile
|
from os.path import realpath, dirname, join, abspath, isfile
|
||||||
|
from io import open
|
||||||
from ssl import OPENSSL_VERSION_INFO, OPENSSL_VERSION
|
from ssl import OPENSSL_VERSION_INFO, OPENSSL_VERSION
|
||||||
try:
|
try:
|
||||||
from yaml import load
|
from yaml import load
|
||||||
|
@ -50,7 +51,7 @@ if not settings_path:
|
||||||
raise Exception('settings.yml not found')
|
raise Exception('settings.yml not found')
|
||||||
|
|
||||||
# load settings
|
# load settings
|
||||||
with open(settings_path, 'rb') as settings_yaml:
|
with open(settings_path, 'r', encoding='utf-8') as settings_yaml:
|
||||||
settings = load(settings_yaml)
|
settings = load(settings_yaml)
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -19,6 +19,7 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >.
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
from os.path import realpath, dirname
|
from os.path import realpath, dirname
|
||||||
|
from io import open
|
||||||
from flask_babel import gettext
|
from flask_babel import gettext
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
from json import loads
|
from json import loads
|
||||||
|
@ -36,7 +37,7 @@ engines = {}
|
||||||
|
|
||||||
categories = {'general': []}
|
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_shortcuts = {}
|
||||||
engine_default_args = {'paging': False,
|
engine_default_args = {'paging': False,
|
||||||
|
|
|
@ -4,6 +4,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import unicodedata
|
import unicodedata
|
||||||
|
|
||||||
|
from io import open
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
if sys.version_info[0] == 3:
|
if sys.version_info[0] == 3:
|
||||||
|
@ -94,7 +95,7 @@ def load():
|
||||||
global db
|
global db
|
||||||
|
|
||||||
current_dir = os.path.dirname(os.path.realpath(__file__))
|
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)
|
db = json.loads(json_data)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue