mirror of
https://github.com/chubin/wttr.in
synced 2024-11-15 08:37:12 +00:00
added workaround for python3 (#369)
This commit is contained in:
parent
89ae801177
commit
e5ab61dea3
3 changed files with 17 additions and 4 deletions
|
@ -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():
|
||||
from_, to_ = line.decode('utf-8').split(':', 1)
|
||||
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
|
||||
|
||||
|
|
10
lib/spark.py
10
lib/spark.py
|
@ -26,14 +26,20 @@ import re
|
|||
import math
|
||||
import json
|
||||
import datetime
|
||||
import StringIO
|
||||
try:
|
||||
import StringIO
|
||||
except:
|
||||
import io as StringIO
|
||||
|
||||
import requests
|
||||
import diagram
|
||||
import pyjq
|
||||
import pytz
|
||||
import numpy as np
|
||||
from astral import Astral, Location
|
||||
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
|
||||
from astral import Astral, Location
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue