correctly join paths and debug log the found results

This commit is contained in:
Janne Sinivirta 2018-02-15 08:56:13 +02:00
parent e3d222912d
commit a1ba57186b
1 changed files with 4 additions and 3 deletions

View File

@ -33,19 +33,20 @@ def load_tickerdata_file(datadir, pair, ticker_interval, timerange=None):
:return dict OR empty if unsuccesful :return dict OR empty if unsuccesful
""" """
path = make_testdata_path(datadir) path = make_testdata_path(datadir)
file = '{abspath}/{pair}-{ticker_interval}.json'.format( file = os.path.join(path, '{pair}-{ticker_interval}.json'.format(
abspath=path,
pair=pair, pair=pair,
ticker_interval=ticker_interval, ticker_interval=ticker_interval,
) ))
gzipfile = file + '.gz' gzipfile = file + '.gz'
# If the file does not exist we download it when None is returned. # If the file does not exist we download it when None is returned.
# If file exists, read the file, load the json # If file exists, read the file, load the json
if os.path.isfile(gzipfile): if os.path.isfile(gzipfile):
logger.debug('Loading ticker data from file %s', gzipfile)
with gzip.open(gzipfile) as tickerdata: with gzip.open(gzipfile) as tickerdata:
pairdata = json.load(tickerdata) pairdata = json.load(tickerdata)
elif os.path.isfile(file): elif os.path.isfile(file):
logger.debug('Loading ticker data from file %s', file)
with open(file) as tickerdata: with open(file) as tickerdata:
pairdata = json.load(tickerdata) pairdata = json.load(tickerdata)
else: else: