Trouble with pyglet on Ubuntu?

Of course there are plenty of Pyweek games that segfault on me for no reason, but it seems to happen disproportionately with pyglet games. A few like that are Robot Underground, Ninja Tower, Bungie Chopper, and Intestinvaders. It's certainly not all pyglet games: I never recall having any trouble at all with any of Alex's games. I seem to remember this is a common problem every time for Ubuntu users, but I can't remember if anyone ever explained what the issue is. I wonder if it has something to do with sound, because for the pyglet games that run, I seem to have lots of issues with sound as well. Does anyone know?

(log in to comment)

Comments

Are your video drivers as up-to-date as humanly possible?
sound could be an issue if some other application is holding on to the resources.. like firefox or some media player. And ya.. you should check richard's suggestion as well.
Crashes most probably are caused by non-compatible OpenGL programming. What's okay for gforce may be a death spell for Intel hardware. Non-power-of-two or rectangle textures caused crashes for me in the past, and stuff like vertex pointers and VBOs are not free from this predicament unless used carefully.

Avbin also could be a source of crashes. I vaguely remember it giving me some trouble, although I wouldn't swear it.
Have you tried running in a debugger to determine where the segfault occurs? If nothing else, that should tell you whether it's a video or an audio issue (or something else entirely).
Ah, of course, a debugger. Good idea. Here's what I get with gdb. For Robot Underground and Ninja Tower it looks like it's an AVBin issue:

(gdb) r run_game.py
Starting program: /usr/bin/python run_game.py
[Thread debugging using libthread_db enabled]
[New Thread 0xb748fb70 (LWP 1357)]

Program received signal SIGSEGV, Segmentation fault.
0x02c291b5 in ?? () from /usr/lib/i686/cmov/libavcodec.so.52


For Bungie Chopper, something with fonts I guess:

(gdb) r run_game.py
Starting program: /usr/bin/python run_game.py
[Thread debugging using libthread_db enabled]
[New Thread 0xb76f5b70 (LWP 1747)]

Program received signal SIGSEGV, Segmentation fault.
0x0221d250 in FT_Request_Size () from /usr/lib/libfreetype.so.6


I suspect that AVBin is probably the culprit in the majority of cases.
You've not mentioned what version of Ubuntu you're using.

AVBin is a thin wrapper about ffmpeg - did you compile it yourself? Perhaps there's some incompatibility that's been introduced in a recent (or old) ffmpeg release (I would not be surprised in the least - that's why avbin exists).

Perhaps Bungie Chopper uses a strange font? Can you check what version of freetype is installed?
I'm currently on 10.04 Lucid Lynx, which didn't exist at the last Pyweek, so.... I'm not sure exactly which Ubuntu version I had during which Pyweeks, but I upgrade fairly regularly.

I don't compile hardly anything myself. I pretty much just use Synaptic for installing everything. According to Synaptic, my libfreetype6 version is 2.3.11-1ubuntu2.1. My ffmpeg version is 4:0.5.1-1ubuntu1. And my libavbin0 version is 7-1build2.
Hm. Well, I'm afraid it's gonna need someone with a closer relationship to Linux than me to help you out :-(
Yeah that's fine. And unfortunately I don't know pyglet, so it might take a little while for me to put together a minimal example to ask about.

I seem to remember there was an environment variable I could set that would disable sound on pyglet. Is that true? It would be a good workaround if I can't figure this out before the competition.
http://pyglet.org/doc/programming_guide/audio_drivers.html (which hints at a doc section "environment settings" which doesn't appear to exist...)

I believe the environment var would be:
 
 PYGLET_AUDIO=silent 
Well, that does silence it, but it doesn't stop the segfaults. Oh well.... :(
btw.. is pyglet still in dev?.. the last release is 1.4.1 and its' been like that for a while now.