Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
nrsc opened this issue Aug 12, 2024 · 3 comments · Fixed by #1482
Assignees
Labels

Comments

@nrsc
Copy link

nrsc commented Aug 12, 2024

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
Copy link
Member

Thank you Scott for the report.

Never enough 👀 and 🧪 ;) 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
Copy link
Author

nrsc commented Aug 13, 2024

Thank you

Copy link

github-actions bot commented Sep 9, 2024

🚀 Issue was released in 0.63.1 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants