diff options
| author | Teddy Wing | 2023-08-08 20:07:33 +0200 |
|---|---|---|
| committer | Teddy Wing | 2023-08-08 20:07:33 +0200 |
| commit | 9d57acc86a01bd3875bcc888a7b6e21128944a93 (patch) | |
| tree | dc3e2af75060218d810b90fd41cd9d93f20daeaa | |
| parent | 71770f3e23f7a3a54ef29b53d8fce9982a8221cf (diff) | |
| download | cws-status-9d57acc86a01bd3875bcc888a7b6e21128944a93.tar.bz2 | |
cws-status: Fix out of bounds error on `item_statuses`
In some cases, `item_statuses` can be shorter than
`item_names_versions`. I didn't look into why, just decided to add a
quick fix for the bounds error so the program could keep working again
without crashing. This seems to fix the problem I had, but it may need
to be revisited further down the line.
| -rw-r--r-- | cws-status | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -111,8 +111,11 @@ item_statuses = tree.xpath('//table[//th[text()="Item"]]/tbody/tr/td[7]/text()') matched_extensions = [] for i, name in enumerate(item_names_versions): - print(i, name, item_names_versions, item_statuses) - print(i, item_statuses) + # `item_statuses` can be shorter than `item_names_versions` for some + # reason. If that happens I guess just show what we could find. + if i >= len(item_statuses): + break + if re.search(regex, name): matched_extensions.append((name, item_statuses[i])) |
