[BUG] Zenodo api error response not saved nor displayed
还没有人认领这个 Issue。
评估
调研方向
从 brainles_preprocessing/utils/zenodo.py 开始,重点查看会引发 403 消息的 _get_metadata_and_archive_url()。使用提供的 Podman 复现,或检查失败请求的路径,然后确认 Zenodo 的错误响应与状态码一起包含在记录的失败信息中。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
When using AtlasCentricPreprocessing, the atlases are downloaded from zenodo on the first run. However, in the event of a non-200 status code, the error response returned along with the status code is neither displayed nor logged, resulting in an unhelpful "Cannot find record '15236131' on Zenodo (response.status_code=403)." We do not know from this message what caused the 403 forbidden error, and Zenodo reports in its documentation that the error response should contain further explanation/debugging steps. Given that using the browser to visit the same api url returns valid json, it is very hard to debug the problem without the error response.
To Reproduce
Steps to reproduce the behavior:
This 403 error might be hard to reproduce since it is intermittent for me in a debian bookworm container. I will try my best to help reproduce the error but I cannot guarantee.
- Create a Containerfile with this content
FROM python:3.12-bookworm
RUN pip install brats[preprocessing] pybids
WORKDIR /workspace
COPY . .
CMD ["python", "/workspace/main.py"]
- Create a minimal main.py in the same directory with this content:
from brainles_preprocessing.constants import Atlas
from brainles_preprocessing.modality import Modality, CenterModality
from brainles_preprocessing.preprocessor import (
AtlasCentricPreprocessor,
)
from brainles_preprocessing.registration import ANTsRegistrator
preprocessor = AtlasCentricPreprocessor(
center_modality=CenterModality(), # Fill in info about your local data here
moving_modalities=[
Modality() # Fill in info about your local data here
],
registrator=ANTsRegistrator(),
atlas_image_path=Atlas.BRATS_MNI152,
)
preprocessor.run()
- Build the container using
podman -v /data/dir/on/your/machine:/mounted/data/dir -t zenodo-test:latest . - Run the container using
podman run zenodo-test
I hope that this does it.
Expected behavior
The error response is logged along with the status code.
Screenshots
2026-01-23 00:53:26.460 | ERROR | brainles_preprocessing.utils.zenodo:_get_metadata_and_archive_url:144 - Cannot find record '15236131' on Zenodo (response.status_code=403).
Traceback (most recent call last):
File "/workspace/main.py", line 301, in <module>
main()
File "/workspace/main.py", line 297, in main
register_to_atlas(temp, output, first_session)
File "/workspace/main.py", line 225, in register_to_atlas
preprocessor = AtlasCentricPreprocessor(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/brainles_preprocessing/preprocessor/atlas_centric_preprocessor.py", line 61, in __init__
atlas_folder = fetch_atlases()
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/brainles_preprocessing/utils/zenodo.py", line 32, in fetch_atlases
return record.fetch()
^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/brainles_preprocessing/utils/zenodo.py", line 71, in fetch
zenodo_response = self._get_metadata_and_archive_url()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/brainles_preprocessing/utils/zenodo.py", line 145, in _get_metadata_and_archive_url
raise ZenodoException(error_msg)
brainles_preprocessing.utils.zenodo.ZenodoException: Cannot find record '15236131' on Zenodo (response.status_code=403).
Environment
operating system and version?
Debian bookworm, no nvidia
Python environment and version?
e.g. Conda environment with Python 3.10. Check your Python version with:
Python 3.12
version of brainles_preprocessing ?
please specify your version of brainles_preprocessing (please make sure you run the latest version): 0.6.8
Additional context
- 主要语言
- C
- 星标
- 39
- 派生
- 11
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
BrainLesion/preprocessing 的其他 Issue
-
bug
难度 3/5 1-2 天 新手友好度 35/100
BrainLesion/preprocessing#190 ·
-
bug
BrainLesion/preprocessing#188 · 1 个 reaction · 已指派 2 人 ·
-
enhancement
难度 4/5 3-5 天 新手友好度 35/100
BrainLesion/preprocessing#185 ·
-
bug
难度 3/5 1-2 天 新手友好度 58/100
BrainLesion/preprocessing#177 · 3 条评论 ·
-
enhancement
BrainLesion/preprocessing#174 · 1 条评论 · 已指派 1 人 ·
查看 BrainLesion/preprocessing 的全部 Issue
相似的 Issue
-
level/task module/gcp type/bug
难度 2/5 1-3 小时 新手友好度 85/100
-
难度 1/5 1 小时以内 新手友好度 86/100
hapostgres/pg_auto_failover#1190 ·
-
docs
难度 1/5 1 小时以内 新手友好度 85/100
-
P3 sonic-vpp
难度 2/5 1-3 小时 新手友好度 88/100
sonic-net/sonic-buildimage#29662 ·
-
难度 1/5 1 小时以内 新手友好度 94/100
spack/spack-packages#6586 ·