Ask coding questions

← Back to all posts
Pygame isn't working
SpotSign (7)

Pygame isn't working. When I run my repl, there is the error:

ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
Comments
hotnewtop
FlaminHotValdez (441)

You need to use Pygame as your language, not Python. When you create a language search Pygame in the languages bar and it should pop up, use the pygame language not the python one.

Trex10 (7)

@FlaminHotValdez
really? I have a pygame repl with valid code and its giving me the same error
https://repl.it/@Trex10/GoldGoldenrodStruct#main.py

FlaminHotValdez (441)

@SpotSign Remove the import pygame line

SpotSign (7)

@FlaminHotValdez No you still need to import it cause:

Traceback (most recent call last):
  File "main.py", line 2, in <module>
    pygame.init()
NameError: name 'pygame' is not defined
exit status 1
RYANTADIPARTHI (6001)

i think it's a server error. Try refreshing, or making a new repl. If all fails, report to bugs.

https://repl.it/bugs

SpotSign (7)

@RYANTADIPARTHI i created a new repl but it doesn't work either

FlaminHotValdez (441)

@RYANTADIPARTHI a. No that's not a bug, he was using a python repl, not a pygame one, b. no begging for cycles.

FlaminHotValdez (441)

@SpotSign Ok, just checked it. Pygame seems to be working on my end but it's always rather dotty.

SpotSign (7)

@FlaminHotValdez And the new repl I created was a python repl, but the same problem happened.

FlaminHotValdez (441)

@SpotSign Wait I think you don't have to import pygame if you're using a python repl maybe that's the problem

RhinoRunner (804)

Pygame is very odd. I actually posted a stackoverflow question on this (before i realized that stackoverflow is kind of bad). You can see some answers there.

RhinoRunner (804)

realization: I had the same problem.
Change:

pygame.image.load('images/duo.png')

to

pygame.image.load('images/duo.png').convert()

and see if that works

RhinoRunner (804)

@SpotSign hmm... maybe .convert_alpha()?

SpotSign (7)

@RhinoRunner Doesn't seem to work either. And what do .convert() and .convert_alpha() in the first place

RhinoRunner (804)

@SpotSign they make the background of the image transparent if the background is transparent (rather than making it black.) probably does some other stuff too.

Also, try using the debugger (located on the sidear.)

RhinoRunner (804)

@SpotSign Above settings.


its the one that looks like >|