gpt4 book ai didi

python - Unicode解码错误: 'ascii' codec can't decode byte 0x87 in position 10: ordinal not in range(128)

转载 作者:太空狗 更新时间:2023-10-30 01:29:17 38 4
gpt4 key购买 nike

我正在使用 images2gif并收到此错误。有什么想法吗?

UnicodeDecodeError:“ascii”编解码器无法解码位置 10 中的字节 0x87:序号不在范围内 (128)

测试文件:

from PIL import Image
from images2gif import writeGif

FRAMES = 2
FRAME_DELAY = 0.75
WIDTH, HEIGHT = 600, 600

frames = []
img1 = Image.open('1.jpg')
img2 = Image.open('2.jpg')
frames.append(img1)
frames.append(img2)

writeGif("test.gif", frames, duration=FRAME_DELAY, dither=0)

回溯:

Traceback (most recent call last):
File "gif.py", line 15, in <module>
writeGif("topmovie.gif", frames, duration=FRAME_DELAY, dither=0)
File "/Users/Craig/Documents/github/RTB/images2gif.py", line 575, in writeGif
gifWriter.writeGifToFile(fp, images, duration, loops, xy, dispose)
File "/Users/Craig/Documents/github/RTB/images2gif.py", line 435, in writeGifToFile
fp.write(header.encode('utf-8'))

images2gif 第 435 行:fp.write(header.encode('utf-8'))

更新的追溯:

Traceback (most recent call last):
File "gif.py", line 16, in <module>
writeGif("test.gif", frames, duration=FRAME_DELAY, dither=0)
File "/Users/Craig/Documents/github/RTB/images2gif.py", line 579, in writeGif
gifWriter.writeGifToFile(fp, images, duration, loops, xy, dispose)
File "/Users/Craig/Documents/github/RTB/images2gif.py", line 440, in writeGifToFile
fp.write(globalPalette)
TypeError: must be string or buffer, not None

最佳答案

您更新的问题也在这里:Error in images2gif.py with GlobalPalette

它引用了 images2gif 上的一个问题,其中作者说他们将重写模块以不使用 PIL/Pillow,但很忙:https://code.google.com/p/visvis/issues/detail?id=81

这又引用了一个声称可以解决问题的补丁 images2gif:https://github.com/rec/echomesh/blob/master/code/python/external/images2gif.py

关于python - Unicode解码错误: 'ascii' codec can't decode byte 0x87 in position 10: ordinal not in range(128),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20576782/

38 4 0
文章推荐: python - 将 pandas.TimeSeries 转换为 R.ts
文章推荐: c# - 过滤 ICollectionView 时性能下降