Python ValueError: 从 bash 管道中读取 png 文件时出现嵌入的空字节

12 浏览
0 Comments

Python ValueError: 从 bash 管道中读取 png 文件时出现嵌入的空字节

from PIL import Image
from subprocess import Popen, PIPE
scr = Image.open(Popen.communicate(Popen(['import','-w','0x02a00001','png:-'], stdout=PIPE))[0])

错误:

  File "/usr/lib/python3/dist-packages/PIL/Image.py", line 2258, in open
    fp = builtins.open(filename, "rb")
ValueError: 嵌入的空字节

0