Thanks.<div>Can we confirm this is really a bug in numpy 1.6.1?</div><div>If is a bug, please report it upstream, and add a link with the info to our ticket.</div><div><br></div><div>Gonzalo<br><br><div class="gmail_quote">
On Thu, Apr 26, 2012 at 11:31 AM, Manuel Kaufmann <span dir="ltr"><<a href="mailto:humitos@gmail.com" target="_blank">humitos@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Invert colors function doesn't work well with numpy version 1.6.1, so this<br>
PATCH is to avoid using this version and use the string module version (slower)<br>
of invert colors instead.<br>
<br>
Signed-off-by: Manuel Kaufmann <<a href="mailto:humitos@gmail.com">humitos@gmail.com</a>><br>
---<br>
Area.py | 11 ++++++++++-<br>
1 file changed, 10 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/Area.py b/Area.py<br>
index 24f02d4..510cb79 100644<br>
--- a/Area.py<br>
+++ b/Area.py<br>
@@ -1033,13 +1033,22 @@ class Area(gtk.DrawingArea):<br>
def proc_invert_color(temp_pix):<br>
try:<br>
import numpy<br>
+ # HACK: This numpy version has a bug and breaks the<br>
+ # 'invert_color' function<br>
+ # <a href="http://bugs.sugarlabs.org/ticket/3509" target="_blank">http://bugs.sugarlabs.org/ticket/3509</a><br>
+ if numpy.__version__ == '1.6.1':<br>
+ logging.warning('You have installed a version of numpy '<br>
+ '(1.6.1) that has a bug and can\'t be '<br>
+ 'used. Using string module instead '<br>
+ '(slower)')<br>
+ raise ImportWarning<br>
pix_manip2 = temp_pix.get_pixels_array()<br>
pix_manip = numpy.ones(pix_manip2.shape, dtype=numpy.uint8) \<br>
* 255<br>
pix_manip2 = pix_manip - pix_manip2<br>
temp_pix = gtk.gdk.pixbuf_new_from_array(pix_manip2,<br>
gtk.gdk.COLORSPACE_RGB, 8)<br>
- except:<br>
+ except (ImportError, ImportWarning):<br>
import string<br>
a = temp_pix.get_pixels()<br>
b = len(a) * ['\0']<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.10<br>
<br>
_______________________________________________<br>
Sugar-devel mailing list<br>
<a href="mailto:Sugar-devel@lists.sugarlabs.org">Sugar-devel@lists.sugarlabs.org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>
</font></span></blockquote></div><br></div>