This was a long time ago (shame on me for not finding the time to investigate this further):
> On Wed, Oct 22, 2008 at 7:23 PM, Marius Gedminas <mar...@gedmin.as> wrote: > > A user reported that PySpaceWar fails on 64-bit Linux machines if I try > > to scale the alpha channel. Here's the code (simplified): > > > > import pygame > > import Numeric > > image = pygame.image.load('title.png') # has an alpha channel > > mask = pygame.surfarray.array_alpha(image).astype(Numeric.Int) > > array = pygame.surfarray.pixels_alpha(self.image) > > alpha = 42.5 # a float between 1 and 255 > > array[:] = (mask * alpha / 255).astype(Numeric.UnsignedInt8) > > > > The error happens on the last line, and it says > > > > ValueError: matrices are not aligned for copy > > > > Any ideas? The code works fine on 32-bit systems. On Wed, Oct 22, 2008 at 09:28:46PM -0500, Charlie Nolan wrote: > I may be having this same error. I've got a bug report with that same > error message at one point (and on a 64-bit machine), even though it > works fine on my (32-bit) machine. Could you try printing out > "array[:].shape"? In my case, I do a sensible slice and somehow end > up with a 0x600 array. On a 32-bit machine: array[:].shape == array.shape == (333, 83) On a 64-bit machine: array[:].shape == (0, 83) On Wed, Oct 22, 2008 at 07:46:53PM -0700, Lenard Lindstrom wrote: > I am curious, but what happens if array[:] is replaced with array[...]. The code starts working! Thank you! > It is a two dimension array, so I am surprised the single index slice > [:] even works. (on 32-bit only, for some reason). > The alternate form [..] is indifferent to array > dimension. It's a thinko on my part. I want an in-place assignment, I tend to write container[:] = new_value, without considering dimensionality at all. Cheers! Marius Gedminas -- A programmer started to cuss Because getting to sleep was a fuss As he lay there in bed Looping 'round in his head was: while(!asleep()) sheep++;
signature.asc
Description: Digital signature