2013-12-13 13 views
5

私はimages2gifで作業していますが、このエラーが発生しています。何か案は?UnicodeDecodeError: 'ascii'コーデックは、位置10の0x87をデコードできません:序数が範囲内にありません(128)

UnicodeDecodeError: 'ascii' codec can't decode byte 0x87 in position 10: ordinal not in range(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 
+1

Pythonのバージョンを、あなたがオンになっていますか? – aIKid

+0

使用しているimages2gifのバージョンは?私は最後のバージョンでその行を見ることができません – PasteBT

+1

このバージョンにはエンコードされていないと私にはより合理的なようですhttps://github.com/luopio/bag-of-tricks/blob/master/python/images2gif.py;なぜ文字列をエンコードできるのか推測できません。 image2gifのコードはpy3のようには見えないので、py2のために書かれていると思います。 – alko

答えて

2

更新された質問はここにもある:https://code.google.com/p/visvis/issues/detail?id=81Error in images2gif.py with GlobalPalette

それは著者は、彼らがPIL /枕を使用しないように、モジュールを書き換えるために行くが、忙しいていると言うれるimages2gif上の問題を参照

順番に問題を解決するために主張されているパッチを適用しimages2gif参照すること:https://github.com/rec/echomesh/blob/master/code/python/external/images2gif.py

関連する問題

 関連する問題