[Sugar-devel] [PATCH Paint] Avoid numpy version 1.6.1

Gonzalo Odiard gonzalo at laptop.org
Thu Apr 26 10:36:28 EDT 2012


Thanks.
Can we confirm this is really a bug in numpy 1.6.1?
If is a bug, please report it upstream, and add a link with the info to our
ticket.

Gonzalo

On Thu, Apr 26, 2012 at 11:31 AM, Manuel Kaufmann <humitos at gmail.com> wrote:

> Invert colors function doesn't work well with numpy version 1.6.1, so this
> PATCH is to avoid using this version and use the string module version
> (slower)
> of invert colors instead.
>
> Signed-off-by: Manuel Kaufmann <humitos at gmail.com>
> ---
>  Area.py |   11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/Area.py b/Area.py
> index 24f02d4..510cb79 100644
> --- a/Area.py
> +++ b/Area.py
> @@ -1033,13 +1033,22 @@ class Area(gtk.DrawingArea):
>         def proc_invert_color(temp_pix):
>             try:
>                 import numpy
> +                # HACK: This numpy version has a bug and breaks the
> +                # 'invert_color' function
> +                # http://bugs.sugarlabs.org/ticket/3509
> +                if numpy.__version__ == '1.6.1':
> +                    logging.warning('You have installed a version of
> numpy '
> +                                    '(1.6.1) that has a bug and can\'t be
> '
> +                                    'used. Using string module instead '
> +                                    '(slower)')
> +                    raise ImportWarning
>                 pix_manip2 = temp_pix.get_pixels_array()
>                 pix_manip = numpy.ones(pix_manip2.shape,
> dtype=numpy.uint8) \
>                             * 255
>                 pix_manip2 = pix_manip - pix_manip2
>                 temp_pix = gtk.gdk.pixbuf_new_from_array(pix_manip2,
>                         gtk.gdk.COLORSPACE_RGB, 8)
> -            except:
> +            except (ImportError, ImportWarning):
>                 import string
>                 a = temp_pix.get_pixels()
>                 b = len(a) * ['\0']
> --
> 1.7.10
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20120426/868b90d0/attachment.html>


More information about the Sugar-devel mailing list