mgedmin / pyspacewar

A game with Newtonian mechanics
https://mg.pov.lt/pyspacewar
GNU General Public License v2.0
6 stars 0 forks source link

Support Python 3 #2

Closed mgedmin closed 7 years ago

mgedmin commented 10 years ago

PyGame supports Python 3.2+ since version 1.9.2.

Checklist:

mgedmin commented 10 years ago

This is blocked on my being unable to get PyGame for Python 3.x (the apt-get-installable package doesn't support Python 3; pip install pygame --pre --allow-unsecure pygame fails to build due to missing kernel header).

nickums commented 8 years ago

I have successfully installed pygame-1.9.2a0.win32-py3.2.msi 6.4MB on python 3.5 (has a nice windows install, not requiring pip or python setup.py) but import pygame gives me ImportError: No module named 'pygame' I'm baffled. unable to open a new issue myself, so please excuse me for raising it here.

nickums commented 8 years ago

OK the win install put pygame in the wrong place. moved it to site-packages. Now I get from pygame.base import * gives: ImportError: DLL load failed: %1 is not a valid Win32 application.

nickums commented 8 years ago

looking further into the pygame directory, most of these modules referrred to by init do not exist:- from pygame.base import from pygame.constants import from pygame.version import * from pygame.rect import Rect from pygame.compat import geterror from pygame.rwobject import encode_string, encode_file_path import pygame.surflock import pygame.color

nickums commented 8 years ago

After reinstalling with the inwtall package in my python directory, all the files seem to be present ok. But I still get: import pygame, pygame.surfarray File "C:\Python\Python35\lib\site-packages\pygameinit.py", line 95, in from pygame.base import * ImportError: DLL load failed: %1 is not a valid Win32 application.

mgedmin commented 7 years ago

There's some progress on this front in the py3 branch, but the game fails after a few seconds with

Traceback (most recent call last):
  File "./pyspacewar", line 31, in <module>
    main()
  File "./src/pyspacewar/main.py", line 70, in main
    ui.wait_for_tick()
  File "./src/pyspacewar/ui.py", line 2737, in wait_for_tick
    self.update_missile_trails()
  File "./src/pyspacewar/ui.py", line 2688, in update_missile_trails
    for missile, trail in self.missile_trails.items():
RuntimeError: dictionary changed size during iteration