Docker中Odoo导入含WebP图片URL的Excel触发PIL.UnidentifiedImageError
Odoo Docker容器导入WebP图片URL报错问题
尝试将包含图片URL的XLSX文件导入Docker容器内的Odoo系统时,部分WebP格式的图片URL触发如下错误:
Traceback (most recent call last): File "<string>", line 1, in <module> File "/var/lib/odoo/.local/lib/python3.10/site-packages/PIL/Image.py", line 3572, in open raise UnidentifiedImageError(msg) PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x75889b2817b0>
使用以下代码进行测试:
- 在Odoo Docker容器的Python解释器(未启动Odoo)中运行,无报错
- 在Odoo运行时的调试控制台中执行,触发上述错误
测试代码:
import io from PIL import Image import requests res = requests.get('https://www.gstatic.com/webp/gallery/1.webp') content = bytearray() for chunk in res.iter_content(32768): content += chunk image = Image.open(io.BytesIO(content))
内容的提问来源于stack exchange,提问作者Arlème Johnson
相关产品推荐
相关产品推荐

