Public bug reported: Feeding a numpy array to make_surface gives an error:
to reproduce: $ python >>> import numpy >>> >>> >>> import pygame >>> >>> >>> a = numpy.zeros((10,20,3), numpy.uint8) >>> >>> >>> pygame.SurfaceArray.make_surface(a) output: IndexError: bytes to write exceed buffer size expected: <Surface(10x20x32) SW)> Stepping through inside, it seems that the buffer has the right size, and the data is the right length at the point the buffer write occurs. But the buffer write fails (and I can't step that) I'm 99% certain that this worked before I upgraded from Kubuntu 13.10 to 14.04 ### transcript Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2] on linux2 >>> import numpy >>> >>> >>> import pygame >>> >>> >>> a = numpy.zeros((10,20,3), numpy.uint8) >>> >>> >>> pygame.SurfaceArray.make_surface(a) >>> >>> Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'SurfaceArray' >>> pygame.surfarray.make_surface(a) >>> >>> Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/dist-packages/pygame/surfarray.py", line 243, in make_surface return numpysf.make_surface (array) File "/usr/lib/python2.7/dist-packages/pygame/_numpysurfarray.py", line 368, in make_surface blit_array (surface, array) File "/usr/lib/python2.7/dist-packages/pygame/_numpysurfarray.py", line 437, in blit_array surface.get_buffer ().write (data, 0) IndexError: bytes to write exceed buffer size $ lsb_release -rd Description: Ubuntu 14.04 LTS Release: 14.04 $ apt-cache policy python-pygame python-pygame: Installed: 1.9.1release+dfsg-9ubuntu1 Candidate: 1.9.1release+dfsg-9ubuntu1 Version table: *** 1.9.1release+dfsg-9ubuntu1 0 500 http://gb.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages 100 /var/lib/dpkg/status ** Affects: pygame (Ubuntu) Importance: Undecided Status: New -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1336214 Title: pygame.surfarray.make_surface(numpyarray) gives IndexError To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/pygame/+bug/1336214/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs