Skip to content

Commit

Permalink
Fix "dumping" message to work correctly for .gz files
Browse files Browse the repository at this point in the history
  • Loading branch information
xmatthias committed Dec 28, 2019
1 parent abc6b94 commit 8f214ae
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion freqtrade/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,16 @@ def file_dump_json(filename: Path, data, is_zip=False) -> None:
:param data: JSON Data to save
:return:
"""
logger.info(f'dumping json to "{filename}"')

if is_zip:
if filename.suffix != '.gz':
filename = filename.with_suffix('.gz')
logger.info(f'dumping json to "{filename}"')

with gzip.open(filename, 'w') as fp:
rapidjson.dump(data, fp, default=str, number_mode=rapidjson.NM_NATIVE)
else:
logger.info(f'dumping json to "{filename}"')
with open(filename, 'w') as fp:
rapidjson.dump(data, fp, default=str, number_mode=rapidjson.NM_NATIVE)

Expand Down

0 comments on commit 8f214ae

Please sign in to comment.