[BUG] Zenodo api error response not saved nor displayed

Đang mở Phù hợp với người mới
#169 7 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
python
Lĩnh vực
api

Hướng nghiên cứu

Bắt đầu tại brainles_preprocessing/utils/zenodo.py, đặc biệt là _get_metadata_and_archive_url(), nơi thông báo 403 được phát sinh. Sử dụng bản tái hiện Podman được cung cấp hoặc kiểm tra đường dẫn của request bị lỗi, sau đó xác minh rằng phản hồi lỗi của Zenodo được đưa vào lỗi đã ghi log cùng với mã trạng thái.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

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.

  1. 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"]
  1. 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()
  1. Build the container using podman -v /data/dir/on/your/machine:/mounted/data/dir -t zenodo-test:latest .
  2. 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

Ngôn ngữ chính
C
Star
39
Fork
11
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của BrainLesion/preprocessing

Tất cả issue của BrainLesion/preprocessing

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.