Opened 11 years ago
Closed 10 years ago
#2177 closed defect (fixed)
g.gui.animation fail to create gif
Reported by: | lucadelu | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.0.0 |
Component: | wxGUI | Version: | svn-trunk |
Keywords: | g.gui.animation | Cc: | |
CPU: | Unspecified | Platform: | Unspecified |
Description
Hi dev,
today I discovered that g.gui.animation fail to create gif image.
Until few weeks ago it worked really well, the error that we (my colleague told me this problem and I'm able to replicate it) discovered is the following
must be string or buffer, not None Reason: must be string or buffer, not None Traceback (most recent call last): File "/home/lucadelu/compilati/grass7/dist.x86_64-unknown-linux-gnu/etc/gui/wxpython/animation/controller.py", line 554, in _export duration=self.timeTick / float(1000), repeat=True) File "/home/lucadelu/compilati/grass7/dist.x86_64-unknown-linux-gnu/etc/python/grass/imaging/images2gif.py", line 575, in writeGif gifWriter.writeGifToFile(fp, images, duration, loops, xy, dispose) File "/home/lucadelu/compilati/grass7/dist.x86_64-unknown-linux-gnu/etc/python/grass/imaging/images2gif.py", line 436, in writeGifToFile fp.write(globalPalette) TypeError: must be string or buffer, not None
Attachments (1)
Change History (14)
follow-up: 2 comment:1 by , 11 years ago
comment:2 by , 11 years ago
Replying to annakrat:
I cannot reproduce it. What version of PIL do you have? I assume 1.1.7? Does this happen always or only in some cases? Luca, could you test what you get here? http://trac.osgeo.org/grass/browser/grass/trunk/lib/python/imaging/images2gif.py#L413
Maybe the getheader function returns None?
Yes, it return a list of None values
Something else to test?
follow-up: 4 comment:3 by , 11 years ago
It looks like some bug in Pillow. If you uninstall it and use PIL instead, it should work. I am not sure if someone opened a ticket for this for Pillow, I couldn't find anything.
follow-up: 5 comment:4 by , 11 years ago
Replying to annakrat:
It looks like some bug in Pillow. If you uninstall it and use PIL instead, it should work. I am not sure if someone opened a ticket for this for Pillow, I couldn't find anything.
Are you speaking about python-pillow? Because it is not installed on my computer...
comment:5 by , 11 years ago
Replying to lucadelu:
Replying to annakrat:
It looks like some bug in Pillow. If you uninstall it and use PIL instead, it should work. I am not sure if someone opened a ticket for this for Pillow, I couldn't find anything.
Are you speaking about python-pillow? Because it is not installed on my computer...
I was able to reproduce the error only when I installed Pillow. When I uninstalled it, everything was fine. Also when you google the error message, there has been a lot of people having the same problems recently but I could not find any solution. Anyway, GRASS is not really responsible for this error and I am not sure how can I fix it.
follow-ups: 7 8 comment:6 by , 11 years ago
I tried on Fedora 20/64bit using the Pillow fix r:
It starts the GIF export, a file of 13 bytes is generated:
file scan2013.gif scan2013.gif: GIF image data, version 89a, 800 x 497
but it crashes with
must be string or buffer, not None Reason: must be string or buffer, not None Traceback (most recent call last): File "/home/neteler/software/grass70/dist.x86_64-unknown-linux-gnu/etc/gui/wxpython/animation/controller.py", line 554, in _export duration=self.timeTick / float(1000), repeat=True) File "/home/neteler/software/grass70/dist.x86_64-unknown-linux-gnu/etc/python/grass/imaging/images2gif.py", line 575, in writeGif gifWriter.writeGifToFile(fp, images, duration, loops, xy, dispose) File "/home/neteler/software/grass70/dist.x86_64-unknown-linux-gnu/etc/python/grass/imaging/images2gif.py", line 436, in writeGifToFile fp.write(globalPalette) TypeError: must be string or buffer, not None
The same error as originally reported.
AFAIK Luca uses PIL on Ubuntu while I use python-pillow 2.2.1 on Fedora. Since PIL is no longer developed, Fedora switched to Pillow.
comment:7 by , 11 years ago
follow-up: 9 comment:8 by , 11 years ago
Replying to neteler:
I tried on Fedora 20/64bit using the Pillow fix r:
The same error as originally reported.
AFAIK Luca uses PIL on Ubuntu while I use python-pillow 2.2.1 on Fedora. Since PIL is no longer developed, Fedora switched to Pillow.
Luca, are you sure you don't have Pillow on your computer? I have the same problem only when I install Pillow. When I uninstall it, it's working again. So it looks like it is a Pillow problem.
comment:9 by , 11 years ago
Replying to annakrat:
Luca, are you sure you don't have Pillow on your computer? I have the same problem only when I install Pillow. When I uninstall it, it's working again. So it looks like it is a Pillow problem.
Sorry Anna, I discovered that python-PIL install python-pillow. So I'm using Pillow, Debian Jessy not provide PIL, we should try to fix this problem or report this bug in Pillow.
comment:10 by , 10 years ago
I still get this error with current relbr7 (r61295 on Fedora 3.14.8-200.fc20.x86_64 with python-pillow-2.2.1-4.fc20.x86_64).
However, I found a partial solution here (patch attached):
http://stackoverflow.com/questions/19149643/error-in-images2gif-py-with-globalpalette
Disadvantage: the background is then black and no more white but at least it stops crashing.
Something more here: http://stackoverflow.com/questions/18325419/error-when-creating-gif-using-images2gif-py
and an apparently slightly updated version here (which contains this bug but other fixes): https://code.google.com/p/visvis/source/browse/vvmovie/images2gif.py
by , 10 years ago
Attachment: | imaging_gif_export_fix.diff added |
---|
Suboptimal patch to avoid animated GIF export crash with palette
comment:11 by , 10 years ago
Thanks to this https://github.com/rec/echomesh/blob/master/code/python/external/images2gif.py, I hopefully fixed it in r61417 in trunk. It should work with PIL or Pillow or both installed. Please test.
follow-up: 13 comment:12 by , 10 years ago
Excellent, the animated GIF export works now in trunk, thanks.
comment:13 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I cannot reproduce it. What version of PIL do you have? I assume 1.1.7? Does this happen always or only in some cases? Luca, could you test what you get here? http://trac.osgeo.org/grass/browser/grass/trunk/lib/python/imaging/images2gif.py#L413
Maybe the getheader function returns None?