Datasets:

Languages:
English
Multilinguality:
monolingual
Size Categories:
10K<n<100K
Language Creators:
crowdsourced
Annotations Creators:
crowdsourced
Source Datasets:
original
ArXiv:
License:
parkervg commited on
Commit
4aa7931
1 Parent(s): 2962e06

Ignore missing JSON files with `FileNotFoundError` except

Browse files

## `KeyError` -> `FileNotFoundError` in Handling Missing Files

In loading the dataset, the following error was raised:

```
FileNotFoundError: [Errno 2] No such file or directory: '~/.cache/huggingface/datasets/downloads/extracted/807f2a9200aa3db507d051a944437b7c8c5eb0de21039735c683affca111c338/WikiTables-WithLinks/tables_tok/The_Real_World:_Brooklyn_0.json'
```

As this error is due to the file `The_Real_World:_Brooklyn_0.json` missing from the repo, it should be caught in the comment made on line 147 ("...filenames with ':'").

However, the `except` clause needs to catch `FileNotFoundError` instead of `KeyError`.

Long-term, would be great to have the missing files handled in this dataset! But short-term, it seems like this PR will fix things (:

Files changed (1) hide show
  1. hybrid_qa.py +1 -1
hybrid_qa.py CHANGED
@@ -144,7 +144,7 @@ class HybridQa(datasets.GeneratorBasedBuilder):
144
  table = json.load(f)
145
  with open(url_data_path, encoding="utf-8") as f:
146
  url_data = json.load(f)
147
- except KeyError: # Some JSON files were not properly added to the GitHub repo: filenames with ':', '"'
148
  continue
149
 
150
  table["header"] = [header[0] for header in table["header"]]
 
144
  table = json.load(f)
145
  with open(url_data_path, encoding="utf-8") as f:
146
  url_data = json.load(f)
147
+ except FileNotFoundError: # Some JSON files were not properly added to the GitHub repo: filenames with ':', '"'
148
  continue
149
 
150
  table["header"] = [header[0] for header in table["header"]]