>1) try building pygame with SDL2.
Built it. It even doesn't return the list of modes. Here is the result:
pi@raspberrypi:~ $ sudo python3 test.py
pygame 1.9.5.dev0
Hello from the pygame community.
https://www.pygame.org/contribute.htmlerror: XDG_RUNTIME_DIR not set in the environment.
None
None
0
error: XDG_RUNTIME_DIR not set in the environment.
Traceback (most recent call last):
File "test.py", line 17, in <module>
screen = pygame.display.set_mode((w, h))
pygame.error: No available video device
>2) instructions on how to debug things and get stack traces.
pi@raspberrypi:~ $ sudo gdb python3
GNU gdb (Raspbian 7.12-6) 7.12.0.20161007-git
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <
http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<
http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<
http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python3...(no debugging symbols found)...done.
(gdb) run test.py
Starting program: /usr/bin/python3 test.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
[New Thread 0x741e5470 (LWP 973)]
[New Thread 0x7394f470 (LWP 974)]
fbcon
<VideoInfo(hw = 1, wm = 0,video_mem = 600
blit_hw = 0, blit_hw_CC = 0, blit_hw_A = 0,
blit_sw = 0, blit_sw_CC = 0, blit_sw_A = 0,
bitsize = 32, bytesize = 4,
masks = (16711680, 65280, 255, 0),
shifts = (16, 8, 0, 0),
losses = (0, 0, 0, 8),
current_w = 480, current_h = 320
>
[(1600, 1200), (1280, 1024), (1024, 1024), (1280, 960), (1152, 864), (1024, 768), (800, 600), (768, 576), (640, 480)]
0
Thread 1 "python3" received signal SIGSEGV, Segmentation fault.
0x769ff104 in SDL_FillRect () from /usr/lib/arm-linux-gnueabihf/libSDL-1.2.so.0
(gdb) backtrace full
#0 0x769ff104 in SDL_FillRect () from /usr/lib/arm-linux-gnueabihf/libSDL-1.2.so.0
No symbol table info available.
#1 0x76a01ae4 in SDL_SetVideoMode () from /usr/lib/arm-linux-gnueabihf/libSDL-1.2.so.0
No symbol table info available.
Backtrace stopped: Cannot access memory at address 0x65001152
While trying to compile pygame with debug messages got too many issues.