Skip to content

Commit

Permalink
Check for empty files
Browse files Browse the repository at this point in the history
  • Loading branch information
RK206 committed Apr 6, 2023
1 parent dd2a40a commit 62152e9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions portality/scripts/history_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,13 @@ def _walk_history_tree(dir, writer):
fid = f.split(".")[0]
path = os.path.join(dirpath, f)
report_path = path[len("reorg/"):]
with open(path, "r", encoding="utf-8") as g:
data = json.load(g)
id = data.get("about", "no id")
date = os.path.basename(dirpath)
writer.writerow([id, date, report_path, fid])
# check for empty files
if os.stat(path).st_size > 0:
with open(path, "r", encoding="utf-8") as g:
data = json.load(g)
id = data.get("about", "no id")
date = os.path.basename(dirpath)
writer.writerow([id, date, report_path, fid])


def _create_new_archives(config):
Expand Down

0 comments on commit 62152e9

Please sign in to comment.