2017-01-16 7 views
1

python3.5.2でimages2gifを使用しているときにエラーが発生しています。Python 3.5.2 images2gifタイプエラー

私はすでに回答を得ているいくつかの問題を経験しましたが、この問題はどこにでも書かれていません。

コード:

from PIL import Image 
from images2gif import writeGif 
import urllib.request 

image_files=["list of png image files in the same directory as the script"] 

images = [Image.open(fn) for fn in image_files] 

gif_file = "test-gif.GIF" 
writeGif(gif_file, images, duration=44) 

エラー:

--------------------------------------------------------------------------- 
TypeError         Traceback (most recent call last) 
<ipython-input-19-75192c4aeed1> in <module>() 
     7 
     8 gif_file = "test-gif.GIF" 
----> 9 writeGif(gif_file, images, duration=44) 

C:\Users\mchoy2\AppData\Local\Continuum\Anaconda3\lib\site-packages\images2gif\images2gif.py in writeGif(filename, images, duration, repeat, dither, nq, subRectangles, dispose) 
    591  fp = open(filename, 'wb') 
    592  try: 
--> 593   gifWriter.writeGifToFile(fp, images, duration, loops, xy, dispose) 
    594  finally: 
    595   fp.close() 

C:\Users\mchoy2\AppData\Local\Continuum\Anaconda3\lib\site-packages\images2gif\images2gif.py in writeGifToFile(self, fp, images, durations, loops, xys, disposes) 
    446 
    447     # Write 
--> 448     fp.write(header) 
    449     fp.write(globalPalette) 
    450     fp.write(appext) 

TypeError: a bytes-like object is required, not 'str' 

編集:images2gifは、Python 2.xのない3のために作られているので

+0

もう少しスタックトレースを投稿できますか?私はあなたがPython 2対Python 3の問題を見ていると思います(Python 3が普及していない2013年以降、ライブラリが更新されていないのがわかります)。 –

+0

@AlexTaylorノートブックに表示されているように完全なエラーを追加しました –

答えて

0

エラーメッセージが表示されている完全なエラーメッセージを表示して更新しました.x