使用OpenReview API下载投稿补充材料遇404错误如何解决?
OpenReview补充材料下载404错误解决方案
问题背景
作为OpenReview某会场程序主席,已通过API成功下载所有投稿PDF,但尝试下载补充材料时触发404 NotFound错误。
已成功的PDF下载代码
pip install openreview-py
import openreview # API V2 client = openreview.api.OpenReviewClient( baseurl='https://api2.openreview.net', username='[redacted]', password='[redacted]' ) notes = client.get_all_notes(invitation = "Your/Venue/ID/-/Submission") for note in notes: if(note.content.get("pdf")): f = client.get_attachment(note.id,'pdf') with open(f'paper{note.number}.pdf','wb') as op: op.write(f)
补充材料下载代码(触发错误)
for note in notes: if(note.content.get("supplementary_material")): f = client.get_attachment(note.id,'supplementary_material') with open(f'paper{note.number}_supplementary_material.zip','wb') as op: op.write(f)
会场补充材料字段配置
{ "supplementary_material": { "value": { "param": { "type": "file", "extensions": [ "zip", "pdf" ], "maxSize": 100, "optional": true, "deletable": true } }, "description": "All supplementary material must be self-contained and zipped into a single file. Note that supplementary material will be visible to reviewers throughout and after the review period, and ensure all material is anonymized. The maximum file size is 100MB.", "order": 7, "readers": [ "confname/2024/Industry_Track", "confname/2024/Industry_Track/Submission${4/number}/Area_Chairs", "confname/2024/Industry_Track/Submission${4/number}/Reviewers", "confname/2024/Industry_Track/Submission${4/number}/Authors" ] } }
错误日志
C:\Users\dernoncourt\anaconda3\envs\openreview\python.exe C:\Users\dernoncourt\openreview\get_all_pdfs.py Traceback (most recent call last): File "C:\Users\dernoncourt\openreview\Lib\site-packages\openreview\api\client.py", line 141, in __handle_response response.raise_for_status() File "C:\Users\dernoncourt\openreview\Lib\site-packages\requests\models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api2.openreview.net/attachment?id=[redacted]&name=supplementary_material During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\dernoncourt\openreview\get_all_pdfs.py", line 26, in <module> f = client.get_attachment(note.id, 'supplementary_material') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\dernoncourt\openreview\Lib\site-packages\openreview\api\client.py", line 609, in get_attachment response = self.__handle_response(response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\dernoncourt\openreview\Lib\site-packages\openreview\api\client.py", line 156, in __handle_response raise OpenReviewException(error) openreview.openreview.OpenReviewException: {'name': 'NotFoundError', 'message': 'The Supplementary Material file was not found (2024-07-19-3654726)', 'status': 404, 'details': {'path': 'note.content.supplementary_material', 'reqId': '2024-07-19-3654726'}} Process finished with exit code 1
解决方案
1. 修正附件存在性判断逻辑
note.content.get("supplementary_material")可能返回空占位字典(仅包含字段定义但无实际文件),需检查是否存在有效附件ID:
for note in notes: suppl_material = note.content.get("supplementary_material") # 验证附件是否实际上传 if suppl_material and isinstance(suppl_material, dict) and suppl_material.get("id"): try: f = client.get_attachment(note.id, 'supplementary_material') # 根据实际文件类型保存,避免强制使用zip后缀 file_ext = suppl_material.get("filename", "").split(".")[-1] if suppl_material.get("filename") else "zip" with open(f'paper{note.number}_supplementary_material.{file_ext}','wb') as op: op.write(f) except openreview.OpenReviewException as e: print(f"Paper {note.number}: Failed to download supplementary material - {e}")
2. 确认账号权限
尽管你是程序主席,需确保你的账号所属组在supplementary_material的readers列表中:
- 登录OpenReview控制台,进入对应投稿详情页
- 查看
supplementary_material字段的权限设置 - 若程序主席组未在
readers内,添加confname/2024/Industry_Track/Program_Chairs到列表中
3. 拉取最新投稿数据
之前的notes对象可能为缓存数据,需重新获取最新投稿信息:
# 重新调用API获取最新的投稿列表 notes = client.get_all_notes(invitation = "Your/Venue/ID/-/Submission")
4. 验证文件是否存在
错误提示文件未找到,可能作者上传后删除了补充材料:
- 通过OpenReview网页端打开对应投稿
- 检查补充材料是否仍存在
内容的提问来源于stack exchange,提问作者Franck Dernoncourt
相关产品推荐
相关产品推荐

