phreeza / cells

a game where players programm agents that compete for resources in a simulated environment
http://phonons.wordpress.com/2010/06/01/cells-a-massively-multi-agent-python-programming-game/
MIT License
222 stars 42 forks source link

IndexError when running cells.py #18

Open markoconnor opened 14 years ago

markoconnor commented 14 years ago

Seen every time I run the master at the moment:

Traceback (most recent call last): File "cells.py", line 547, in game.tick() File "cells.py", line 210, in tick self.plant_population, self.energy_map) File "cells.py", line 456, in update pygame.transform.scale(pygame.surfarray.make_surface(numpy.array(img)), File "/Library/Python/2.6/site-packages/pygame-1.9.1release-py2.6-macosx-10.6-universal.egg/pygame/surfarray.py", line 243, in make_surface return numpysf.make_surface (array) File "/Library/Python/2.6/site-packages/pygame-1.9.1release-py2.6-macosx-10.6-universal.egg/pygame/_numpysurfarray.py", line 368, in make_surface blit_array (surface, array) File "/Library/Python/2.6/site-packages/pygame-1.9.1release-py2.6-macosx-10.6-universal.egg/pygame/_numpysurfarray.py", line 437, in blit_array surface.get_buffer ().write (data, 0) IndexError: bytes to write exceed buffer size

Also seen by icefox on ubuntu karmic. Works on Fedora 12.

My pygame is 1.9.1release and numpy is 1.2.1 on the OS/X box that gets the error. On Fedora 12, where it works, they're 1.9.1release and 1.3.0 respectively.

UPDATE: when trying to get psycho working, I ran this to force python into 32-bit mode: defaults write com.apple.versioner.python Prefer-32-Bit -bool yes

it didn't work, but now I can run cells.py just fine on my OS/X box, too.

pavellishin commented 14 years ago

I didn't try to install psyco, but I tried the 32-bit mode trick - it changed the error message, but the game still won't run.

defaults write com.apple.versioner.python Prefer-32-Bit -bool yes
python cells.py minds/mind1.py minds/mind2.py

results in

Traceback (most recent call last):
  File "cells.py", line 15, in <module>
    import pygame, pygame.locals
  File "/Library/Python/2.6/site-packages/pygame-1.9.1release-py2.6-macosx-10.6-universal.egg/pygame/__init__.py", line 95, in <module>
    from pygame.base import *
ImportError: dlopen(/Library/Python/2.6/site-packages/pygame-1.9.1release-py2.6-macosx-10.6-universal.egg/pygame/base.so, 2): no suitable image found.  Did find:
    /Library/Python/2.6/site-packages/pygame-1.9.1release-py2.6-macosx-10.6-universal.egg/pygame/base.so: mach-o, but wrong architecture

OS X 10.6.3, Python 2.6.1, numpy 1.4.1, pygame 1.9.1

pavellishin commented 14 years ago

Nevermind, grabbed the latest version and everything is gravy.