mirror of
https://github.com/chubin/wttr.in.git
synced 2025-08-13 23:38:24 +02:00
added workaround for python3 (#369)
This commit is contained in:
@ -168,7 +168,11 @@ def load_aliases(aliases_filename):
|
||||
aliases_db = {}
|
||||
with open(aliases_filename, 'r') as f_aliases:
|
||||
for line in f_aliases.readlines():
|
||||
try:
|
||||
from_, to_ = line.decode('utf-8').split(':', 1)
|
||||
except AttributeError:
|
||||
from_, to_ = line.split(':', 1)
|
||||
|
||||
aliases_db[location_normalize(from_)] = location_normalize(to_)
|
||||
return aliases_db
|
||||
|
||||
|
@ -26,14 +26,20 @@ import re
|
||||
import math
|
||||
import json
|
||||
import datetime
|
||||
try:
|
||||
import StringIO
|
||||
except:
|
||||
import io as StringIO
|
||||
|
||||
import requests
|
||||
import diagram
|
||||
import pyjq
|
||||
import pytz
|
||||
import numpy as np
|
||||
try:
|
||||
from astral import Astral, Location
|
||||
except ImportError:
|
||||
pass
|
||||
from scipy.interpolate import interp1d
|
||||
from babel.dates import format_datetime
|
||||
|
||||
|
@ -17,7 +17,10 @@ import sys
|
||||
import re
|
||||
import datetime
|
||||
import json
|
||||
try:
|
||||
from astral import Astral, Location
|
||||
except ImportError:
|
||||
pass
|
||||
from constants import WWO_CODE, WEATHER_SYMBOL, WIND_DIRECTION
|
||||
from weather_data import get_weather_data
|
||||
import spark
|
||||
|
Reference in New Issue
Block a user