Skip to content

Commit 106e0a6

Browse files
committed
BUGFIX: handle case that there is no 'geninfo' data.
Signed-off-by: Henry Cox <[email protected]>
1 parent 5a9f950 commit 106e0a6

File tree

1 file changed

+29
-26
lines changed

1 file changed

+29
-26
lines changed

bin/spreadsheet.py

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -671,32 +671,35 @@ def visitScope(f, dirname):
671671
summarySheet.hide()
672672

673673
# insert the average and variance data...
674-
col = 1
675-
lastSummaryRow = firstSummaryRow + len(geninfoSheets) - 1
676-
avgRow = 1
677-
devRow = 2
678-
firstCol = col
679-
for k in (*geninfoChunkKeys, *geninfoKeys):
680-
if k in ('order',):
681-
continue
682-
for j in ('sum', 'avg'):
683-
f = xl_rowcol_to_cell(firstSummaryRow, col)
684-
t = xl_rowcol_to_cell(lastSummaryRow, col)
685-
avg = "+AVERAGE(%(from)s:%(to)s)" % {
686-
'from': f,
687-
'to': t,
688-
}
689-
summarySheet.write_formula(avgRow, col, avg, twoDecimal)
690-
avgCell = xl_rowcol_to_cell(avgRow, col)
691-
dev = "+STDEV(%(from)s:%(to)s)" % {
692-
'from': f,
693-
'to': t,
694-
}
695-
summarySheet.write_formula(devRow, col, dev, twoDecimal)
696-
col += 1
697-
698-
insertConditional(summarySheet, avgRow, devRow,
699-
firstSummaryRow, firstCol, lastSummaryRow, col -1)
674+
# (there will not be any such data if we didn't run geninfo)
675+
try:
676+
col = 1
677+
lastSummaryRow = firstSummaryRow + len(geninfoSheets) - 1
678+
avgRow = 1
679+
devRow = 2
680+
firstCol = col
681+
for k in (*geninfoChunkKeys, *geninfoKeys):
682+
if k in ('order',):
683+
continue
684+
for j in ('sum', 'avg'):
685+
f = xl_rowcol_to_cell(firstSummaryRow, col)
686+
t = xl_rowcol_to_cell(lastSummaryRow, col)
687+
avg = "+AVERAGE(%(from)s:%(to)s)" % {
688+
'from': f,
689+
'to': t,
690+
}
691+
summarySheet.write_formula(avgRow, col, avg, twoDecimal)
692+
avgCell = xl_rowcol_to_cell(avgRow, col)
693+
dev = "+STDEV(%(from)s:%(to)s)" % {
694+
'from': f,
695+
'to': t,
696+
}
697+
summarySheet.write_formula(devRow, col, dev, twoDecimal)
698+
col += 1
699+
insertConditional(summarySheet, avgRow, devRow,
700+
firstSummaryRow, firstCol, lastSummaryRow, col -1)
701+
except:
702+
pass
700703
s.close()
701704

702705
if __name__ == "__main__":

0 commit comments

Comments
 (0)