-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
/usr/local/lib/python3.10/site-packages/dashscope/utils/oss_utils.py:148: ResourceWarning: unclosed file <_io.BufferedReader name='/app/src/temp/bgr_dd42a2cec9ef469cbd4b0d5cc097c50c.jpg'>
file_url = OssUtils.upload(model=model,
ResourceWarning: Enable tracemalloc to get the object allocation traceback
**files = {'file': open(file_path, 'rb')}** # 请使用 with open('文件路径', 'rb') as f: 的结构来打开文件
with requests.Session() as session:
response = session.post(url,
files=files,
data=form_data,
headers=headers,
timeout=3600)
if response.status_code == HTTPStatus.OK:
return 'oss://' + form_data['key']
else:
msg = (
'Uploading file: %s to oss failed, error: %s' %
(file_path, cls._decode_response_error(response=response)))
logger.error(msg)
raise UploadFileException(msg)
Metadata
Metadata
Assignees
Labels
No labels