From 1d3ff006cd5bc5e2b04734676527b2621e852de7 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Fri, 17 Dec 2021 11:35:00 +0000 Subject: [PATCH] collate.py: Correction so it works with dump/ files And adjust the dile docstring to point out it will only work with the dump/ file format, not the new 'File > Save Raw Data' one. --- collate.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/collate.py b/collate.py index 0350485f..d789a6c5 100755 --- a/collate.py +++ b/collate.py @@ -1,5 +1,11 @@ #!/usr/bin/env python3 -"""Collate lists of seen commodities, modules and ships from dumps of the Companion API output.""" +""" +Collate lists of seen commodities, modules and ships from dumps of the Companion API output. + +Note that currently this will only work with the output files created if you +run the main program from a working directory that has a `dump/` directory, +which causes a file to be written per CAPI query. +""" import csv import json @@ -210,6 +216,7 @@ if __name__ == "__main__": with open(file_name) as f: print(file_name) data = json.load(f) + data = data['data'] if not data['commander'].get('docked'): print('Not docked!')