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

[Bug]: DANDI Upload with session ID that contains "/" fails #1156

Open
2 tasks done
rly opened this issue Dec 12, 2024 · 0 comments
Open
2 tasks done

[Bug]: DANDI Upload with session ID that contains "/" fails #1156

rly opened this issue Dec 12, 2024 · 0 comments
Labels

Comments

@rly
Copy link
Contributor

rly commented Dec 12, 2024

What happened?

See dandi/helpdesk#169 (comment)

The user has an NWB file with session_id = "BLA-projecting NBM/SI neuron from animal M24 on 26/07/2023". It looks like NeuroConv or dandi-cli is replacing the "/" in the session ID with "\" when renaming the file before upload, and therefore the file cannot be found.

DANDI uses the following format for file names: {dandiset_id}/sub-{subject_id}/sub-{subject_id}_ses-{session_id}.nwb so a "/" in the session ID (or subject ID) would cause problems unless handled in a special way.

The error is reported in NWB GUIDE, but from what I can trace, the error comes from calling neuroconv. See traceback below. The inputs to automatic_dandi_upload is a folder /Users/rly/NWB_GUIDE/.temp/upload/temp_20241211-150938 with contents:

ls -al ~/NWB_GUIDE/.temp/upload/temp_20241211-150938 
total 0
drwxr-xr-x  3 rly  staff   96 Dec 11 15:09 .
drwxr-xr-x  6 rly  staff  192 Dec 11 15:09 ..
lrwxr-xr-x  1 rly  staff   60 Dec 11 15:09 MACAQUE_CHOL_NBM_FL_20230726T173713.nwb -> /Users/rly/Downloads/MACAQUE_CHOL_NBM_FL_20230726T173713.nwb

So the file is renamed with the session ID by neuroconv or dandi organize.

Related:

Steps to Reproduce

See linked issue

Traceback

[2024-12-11 15:09:41,427] ERROR in app: Exception on /neuroconv/upload [POST]
Traceback (most recent call last):
  File "/Users/rly/miniconda3/envs/nwb-guide/lib/python3.9/site-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/rly/miniconda3/envs/nwb-guide/lib/python3.9/site-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/Users/rly/miniconda3/envs/nwb-guide/lib/python3.9/site-packages/flask_restx/api.py", line 404, in wrapper
    resp = resource(*args, **kwargs)
  File "/Users/rly/miniconda3/envs/nwb-guide/lib/python3.9/site-packages/flask/views.py", line 109, in view
    return current_app.ensure_sync(self.dispatch_request)(**kwargs)
  File "/Users/rly/miniconda3/envs/nwb-guide/lib/python3.9/site-packages/flask_restx/resource.py", line 46, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/Users/rly/Documents/NWB/nwb-guide/src/pyflask/namespaces/neuroconv.py", line 162, in post
    return upload_multiple_filesystem_objects_to_dandi(**neuroconv_namespace.payload)
  File "/Users/rly/Documents/NWB/nwb-guide/src/pyflask/manageNeuroconv/manage_neuroconv.py", line 1338, in upload_multiple_filesystem_objects_to_dandi
    results = upload_folder_to_dandi(**innerKwargs)
  File "/Users/rly/Documents/NWB/nwb-guide/src/pyflask/manageNeuroconv/manage_neuroconv.py", line 1366, in upload_folder_to_dandi
    return automatic_dandi_upload(
  File "/Users/rly/miniconda3/envs/nwb-guide/lib/python3.9/site-packages/neuroconv/tools/data_transfers/_dandi.py", line 98, in automatic_dandi_upload
    organized_nwbfile.rename(organized_nwbfile.parent / corrected_name)
  File "/Users/rly/miniconda3/envs/nwb-guide/lib/python3.9/pathlib.py", line 1382, in rename
    self._accessor.rename(self, target)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/rly/NWB_GUIDE/.temp/upload/tmpabsrwlgc/215860/sub-M24/sub-M24_icephys.nwb' -> '/Users/rly/NWB_GUIDE/.temp/upload/tmpabsrwlgc/215860/sub-M24/sub-M24_ses-BLA-projecting NBM/SI neuron from animal M24 on 26/07/2023_icephys.nwb'

Operating System

macOS

Python Executable

Python

Python Version

3.12

Package Versions

No response

Code of Conduct

@rly rly added the bug label Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant