[GRASS-dev] [GRASS GIS] #2815: Grass and Pillow > 3.0.0

#2815: Grass and Pillow > 3.0.0
-------------------------+-------------------------
Reporter: pmav99 | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.3
Component: wxGUI | Version:
Keywords: animation | CPU: All
Platform: Unspecified |
-------------------------+-------------------------
Pillow since version 3.0.0 removed the `fromstring()` method[1]. AFAIK the
only usage of the `fromstring()` method in GRASS in g.gui.animation:

{{{
$ ag fromstring

[omit etree.fromstring() results]

gui/wxpython/animation/utils.py
263: pilImage.fromstring(image.GetData())
}}}

I believe it is rather safe to replace the call with `frombytes()`. If we
need to keep compatibility with the original PIL I guess that something
like this would do it:
{{{
def WxImageToPil(image):
     """Converts wx.Image to PIL image"""
     pilImage = Image.new('RGB', (image.GetWidth(), image.GetHeight()))
     try:
         pilImage.frombytes(image.GetData())
     except Exception:
         # We are using the original Pil or an old Pillow version
         pilImage.fromstring(image.GetData())
     return pilImage
}}}

[1] https://github.com/python-
pillow/Pillow/commit/71c95c8e5f3bba1845444a246d04646825e6bab3

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2815&gt;
GRASS GIS <https://grass.osgeo.org>

#2815: Grass and Pillow > 3.0.0
---------------------+-------------------------
  Reporter: pmav99 | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.3
Component: wxGUI | Version: unspecified
Resolution: | Keywords: animation
       CPU: All | Platform: Unspecified
---------------------+-------------------------
Changes (by pmav99):

* version: => unspecified

Comment:

This should be the exact same issue:
http://osgeo-org.1560.x6.nabble.com/d-mon-using-PIL-tostring-not-used-
anymore-tobytes-to-be-used-td5239514.html

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2815#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>

#2815: Grass and Pillow > 3.0.0
---------------------+----------------------------
  Reporter: pmav99 | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.3
Component: wxGUI | Version: unspecified
Resolution: | Keywords: animation, PIL
       CPU: All | Platform: Unspecified
---------------------+----------------------------
Changes (by annakrat):

* keywords: animation => animation, PIL

Comment:

Fixed in r67012. Please test.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2815#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#2815: Grass and Pillow > 3.0.0
---------------------+----------------------------
  Reporter: pmav99 | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.0.3
Component: wxGUI | Version: unspecified
Resolution: fixed | Keywords: animation, PIL
       CPU: All | Platform: Unspecified
---------------------+----------------------------
Changes (by pmav99):

* status: new => closed
* resolution: => fixed

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2815#comment:3&gt;
GRASS GIS <https://grass.osgeo.org>

#2815: Grass and Pillow > 3.0.0
---------------------+----------------------------
  Reporter: pmav99 | Owner: grass-dev@…
      Type: defect | Status: reopened
  Priority: normal | Milestone: 7.0.3
Component: wxGUI | Version: unspecified
Resolution: | Keywords: animation, PIL
       CPU: All | Platform: Unspecified
---------------------+----------------------------
Changes (by neteler):

* status: closed => reopened
* resolution: fixed =>

Comment:

Replying to [comment:3 pmav99]:
> Resolution set to fixed
> Status changed from new to closed

Didn't you want the fix also in 7.0? The backport has not happened yet, so
please don't close the ticket yet. Or is no backport wanted?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2815#comment:4&gt;
GRASS GIS <https://grass.osgeo.org>

#2815: Grass and Pillow > 3.0.0
---------------------+----------------------------
  Reporter: pmav99 | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.0.3
Component: wxGUI | Version: unspecified
Resolution: fixed | Keywords: animation, PIL
       CPU: All | Platform: Unspecified
---------------------+----------------------------
Changes (by annakrat):

* status: reopened => closed
* resolution: => fixed

Comment:

Backported in r67035.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2815#comment:5&gt;
GRASS GIS <https://grass.osgeo.org>