Support Python 3

#2 · closed · 6 comments

View on GitHub ↗

mgedmin

PyGame supports Python 3.2+ since version 1.9.2. Checklist: - [x] make it possible to run tests using `tox` - pygame [not being pip installable](https://bitbucket.org/pygame/pygame/issue/59/pygame-has-no-pypi-page-and-cant-be#comment-9949946) might make this tricky, if tests try to import pygame (they do) - `sitepackages = true` lets me use apt-get installed pygame, which is available for Python 2.7 only - [x] set up a Jenkins job at https://jenkins.gedmin.as - [x] add a .travis.yml - [x] add version classifiers to setup.py - [x] make it possible to run tests using `tox` using Python versions other than 2.7 - [x] port to the common language subset - [x] add new PyPI classifiers - [x] add NEWS.rst entry - [x] make a new release

Comments

mgedmin

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

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

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

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

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\pygame__init__.py", line 95, in <module> from pygame.base import * ImportError: DLL load failed: %1 is not a valid Win32 application.

mgedmin

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 ```