Stream mode FileNotFound exception handling
Browse files- pmc_open_access_xml.py +4 -1
pmc_open_access_xml.py
CHANGED
|
@@ -533,7 +533,10 @@ class OpenAccessXML(datasets.GeneratorBasedBuilder):
|
|
| 533 |
# Incrementals
|
| 534 |
if incremental_file_lists:
|
| 535 |
for incremental_file_list, incremental_archive in zip(incremental_file_lists[::-1], incremental_archives[::-1]):
|
| 536 |
-
|
|
|
|
|
|
|
|
|
|
| 537 |
incrementals = incrementals.join(oa_package_list).reset_index().set_index("Article File")
|
| 538 |
incrementals.File = incrementals.File.fillna('')
|
| 539 |
incrementals = incrementals.to_dict(orient="index")
|
|
|
|
| 533 |
# Incrementals
|
| 534 |
if incremental_file_lists:
|
| 535 |
for incremental_file_list, incremental_archive in zip(incremental_file_lists[::-1], incremental_archives[::-1]):
|
| 536 |
+
try:
|
| 537 |
+
incrementals = pd.read_csv(incremental_file_list, index_col="AccessionID")
|
| 538 |
+
except FileNotFoundError: # File not found can happen here in stream mode
|
| 539 |
+
continue
|
| 540 |
incrementals = incrementals.join(oa_package_list).reset_index().set_index("Article File")
|
| 541 |
incrementals.File = incrementals.File.fillna('')
|
| 542 |
incrementals = incrementals.to_dict(orient="index")
|