Skip to content

Commit e0e2bc7

Browse files
committed
[QOL] Skip label if importError
Prevent program crash due to empty table.
1 parent 4a5edbf commit e0e2bc7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

main.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ def getLabel(label,type='single'):
2828
print('Index:', index)
2929
driver.get(baseUrl.format(label, index))
3030
driver.implicitly_wait(5)
31-
newTable = pd.read_html(driver.page_source)[0]
31+
try:
32+
newTable = pd.read_html(driver.page_source)[0]
33+
except ImportError:
34+
print(label,"Skipping label due to error")
35+
return
3236
table_list.append(newTable[:-1]) # Remove last item which is just sum
3337
index += 100
3438
if (len(newTable.index) != 101):

0 commit comments

Comments
 (0)