Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UnicodeDecodeError: 'ascii' codec can't decode byte 0x87 in position 10: ordinal not in range(128)

I'm working with images2gif and getting this error. Any ideas?

UnicodeDecodeError: 'ascii' codec can't decode byte 0x87 in position 10: ordinal not in range(128)

Test file:

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:

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 line 435: fp.write(header.encode('utf-8'))

Updated traceback:

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
like image 453
Craig Cannon Avatar asked Nov 02 '22 09:11

Craig Cannon


1 Answers

Your updated question is also here: Error in images2gif.py with GlobalPalette

It references an issue on images2gif in which the author says they're going to rewrite the module to not use PIL/Pillow, but are busy: https://code.google.com/p/visvis/issues/detail?id=81

That in turn references a patched images2gif that is claimed to fix the issue: https://github.com/rec/echomesh/blob/master/code/python/external/images2gif.py

like image 85
Jason S Avatar answered Nov 09 '22 05:11

Jason S