abcd-j / data-catalog

https://data.abcd-j.de
0 stars 1 forks source link

Error running `code/process_subdirectory.py` #14

Closed tmheunis closed 6 months ago

tmheunis commented 6 months ago

When I run:

> data-catalog git:(main) python3 code/process_subdirectory.py data UKD/ocr-PIRA-cohort --dataset-type other --add-to-catalog

i get the error:

Traceback (most recent call last):
  File "/Users/theunis/Documents/psyinf/abcdj/data-catalog/code/process_subdirectory.py", line 39, in <module>
    subds_tabby_records = get_tabby_metadata(
  File "/Users/theunis/Documents/psyinf/abcdj/data-catalog/code/get_tabby_metadata.py", line 155, in get_tabby_metadata
    cat_file = file_required_meta | process_file(file_info)
  File "/Users/theunis/Documents/psyinf/abcdj/data-catalog/code/utils.py", line 206, in process_file
    "path": f.get("path", {}).get("@value"),
AttributeError: 'str' object has no attribute 'get'

I inspected the code and saw that there's a for loop trying to loop through a dictionary, although the code is expecting a list.

https://github.com/abcd-j/data-catalog/blob/ca14d92e3bd41d3cf97a28a4cfbf4488684258c3/code/get_tabby_metadata.py#L154

I made some local changes to ensure that the variable is a list before the loop, will commit this later.

jsheunis commented 6 months ago

Fixed in de4c21cb35f445121aca87500e017cf42f70e1be

Thanks!