dandi / dandi-cli

DANDI command line client to facilitate common operations
https://dandi.readthedocs.io/
Apache License 2.0
22 stars 27 forks source link

failed to extract metadata: UnboundLocalError: local variable 'value' referenced before assignment #1481

Closed nrsc closed 3 months ago

nrsc commented 3 months ago

When trying to upload a dataset, I get a number of errors regarding a local variable "value" and a failure to extract metadata.

Traceback below

Traceback (most recent call last):
  File "/home/nrsc/.local/lib/python3.10/site-packages/dandi/upload.py", line 346, in process_path
    metadata = dfile.get_metadata(
  File "/home/nrsc/.local/lib/python3.10/site-packages/dandi/files/bases.py", line 484, in get_metadata
    metadata = nwb2asset(self.filepath, digest=digest)
  File "/home/nrsc/.local/lib/python3.10/site-packages/dandi/metadata/nwb.py", line 150, in nwb2asset
    asset_md = prepare_metadata(metadata)
  File "/home/nrsc/.local/lib/python3.10/site-packages/dandi/metadata/core.py", line 76, in prepare_metadata
    return extract_model(models.BareAsset, metadata)
  File "/home/nrsc/.local/lib/python3.10/site-packages/dandi/metadata/util.py", line 511, in extract_model
    value = kwargs.get(field, extract_field(field, metadata))
  File "/home/nrsc/.local/lib/python3.10/site-packages/dandi/metadata/util.py", line 628, in extract_field
    return FIELD_EXTRACTORS[field](metadata)
  File "/home/nrsc/.local/lib/python3.10/site-packages/dandi/metadata/util.py", line 522, in func
    m = extract_model(
  File "/home/nrsc/.local/lib/python3.10/site-packages/dandi/metadata/util.py", line 511, in extract_model
    value = kwargs.get(field, extract_field(field, metadata))
  File "/home/nrsc/.local/lib/python3.10/site-packages/dandi/metadata/util.py", line 628, in extract_field
    return FIELD_EXTRACTORS[field](metadata)
  File "/home/nrsc/.local/lib/python3.10/site-packages/dandi/metadata/util.py", line 477, in extract_species
    f"Cannot interpret species field: {value}. Please "
UnboundLocalError: local variable 'value' referenced before assignment

Any help would be appreciated.

Cheers,

Scott

yarikoptic commented 3 months ago

Thank you Scott for the report.

Never enough :eyes: and :test_tube: ;) Fix is coming shortly. Meanwhile check the species value you have - you would need to use URL to point to known place in some ontology, or provide one of the known for us to map values.

nrsc commented 3 months ago

Thank you

github-actions[bot] commented 2 months ago

:rocket: Issue was released in 0.63.1 :rocket: