2017-03-04 15 views
1

嘗試向我的pygame遊戲添加聲音文件時發生此錯誤。使用pygame時我從來沒有見過的奇怪python錯誤

import sys, pygame 
from pygame.locals import * 


class game(): 

    def __init__(self): 

     pygame.init() 
     pygame.font.init() 
     pygame.mixer.init() 

     # set key hold down repeat 

     pygame.key.set_repeat(2,2) 

     # Image Sizes and positions and movement speeds 
     self.lives_size = 700, 200 
     self.padle_size = [50,10] 
     self.padle_pos = [350, 685] 
     self.game_size = self.width, self.height = 700,700 
     self.gButton_pos = [150, 300 ] 
     self.gButton_size = [100, 50] 
     self.rButton_pos = [450, 300] 
     self.rButton_size = [100, 50] 

     # Balls Movement Speed 
     # Note: this is confusing because its both speed AND direction 
     self.speedX = -2  # X coordinate movement for ball 
     self.speedY = 1  # Y coordinate movement for ball 
     self.speed = [self.speedX, self.speedY] # Total ball Movement speed 

     # Sound effects 
     self.pong = pygame.mixer.Sound("pingpong.wav") 

     # Number of lives 
     self.num_lives = 1 

     # Colors, RGB values 
     self.white = 255, 255, 255 
     self.black = 0, 0, 0 
     self.red = 200,0,0 
     self.green = 0,200,0 
     self.b_red = 255,0,0 
     self.b_green = 0,255,0 

     # Font style and display 
     self.font = pygame.font.SysFont("Verdona", 24) 
     self.font_color = self.black 
     self.font_background = self.white 

     # game state 
     self.pause = False 



     # Label area where lives are displayed 
     # Game over display not currently working 
     self.display_lives = pygame.display.set_mode(self.lives_size) 


     # Main Window for game... Wierd spot for it 
     self.main_window = pygame.display.set_mode((700,720)) 

     # Game play Window 
     self.screen = pygame.Surface((self.game_size)) 
     self.screen_rect = self.screen.get_rect() 

     # Make game oover window image 
     #game_over = pygame.display.set_mode((200,200)) 
     #gameover_rect = self.game_over.get_rect() 

     # Importing ball Image 
     self.ball = pygame.image.load("redball2.png") 
     self.ballrect = self.ball.get_rect() 


    def textObjects(self, text, font): 
     textSurface = font.render(text, True, self.black) 
     return textSurface, textSurface.get_rect() 

    def Button(self, msg, color, b_color, x,y, w,h, action = None): 

     mouse = pygame.mouse.get_pos() 
     click = pygame.mouse.get_pressed() 
     print(mouse) 


     # identify button boundry 

     boundry = x + w > mouse[0] > x and y + h > mouse[1] > y 

     # button image/active vs inactives 

     if boundry is True: 

      pygame.draw.rect(self.main_window, b_color, Rect((x,y), (w,h))) 

      if click[0] == 1 and action != None: 

       if action == "start": 
        self.num_lives = 5 
        self.game_loop() 

       elif action == "quit": 
        pygame.quit() 


     else: 

      pygame.draw.rect(self.main_window, color, Rect((x,y), (w,h))) 

     text = pygame.font.SysFont("Verdona", 40) 
     textSurface, textRect = self.textObjects(msg, text) 
     self.main_window.blit(textSurface, (x, y),textRect) 




    def paddle(self): 

     # make the padle 
     # This is the pygame Drawing function 
     paddle = pygame.draw.rect(self.screen, self.black, 
       Rect(self.padle_pos, self.padle_size)) 
     return paddle 


    def moveBall(self): 
     # Doesn't only move ball 
     # updates lives 
     # places windows 

     # Fill main window color Black 
     self.main_window.fill((self.black)) 

     # place the game play window on main window 
     self.main_window.blit(self.screen, (0,20), self.screen_rect) 

     # Show Lives 
     lives = "lives left: {}".format(self.num_lives) 
     label = self.font.render(
       lives,   # The string to render 
       1,    # With anti aliasing 
       self.font_color, 
       self.font_background) 

     # Make lives display an image object 
     label_rect = label.get_rect() 

     # place the lives display on the window made for it 
     self.display_lives.blit(label, (300, 0),label_rect) 


     # place the game play window on main window 
     self.main_window.blit(self.screen, (0,20), self.screen_rect) 
     # place the lives display on the window made for it 
     self.screen.fill(self.white) 

     #place the ball on the screen 
     self.screen.blit(self.ball, self.ballrect) 
     pygame.display.flip() 

    def hitPadle(self): 
     pass 

    def gameOver(self): 

     self.screen.fill((self.white)) 
     self.main_window.blit(self.screen, (0,20), self.screen_rect) 


     while True: 

      for event in pygame.event.get(): 
       #print(event) 
       if event.type == pygame.QUIT: 
        pygame.quit() 
        #quit() 

      self.Button("AGAIN!",self.green, self.b_green, 150,300, 100,50, "start") 
      self.Button("QUIT",self.red, self.b_red, 450,300, 100,50, "quit") 


      pygame.display.flip() 


    def paused(self): 

      #largeText = pygame.font.SysFont("comicsansms",115) 
      #TextSurf, TextRect = text_objects("Paused", largeText) 
      #TextRect.center = ((display_width/2),(display_height/2)) 
      #gameDisplay.blit(TextSurf, TextRect) 

      while self.pause: 

       for event in pygame.event.get(): 

        if event.type == pygame.QUIT: 
         pygame.quit() 
         quit() 

        if event.type == KEYDOWN: 
         if event.key == K_c: 
          self.pause = False 
          break 



    def game_loop(self): 

     # OK here we go 
     # Ignore ALL print statements, they are there for debug 

     # make some variables to help direction changes 
     change_direction = False 
     speedX = 2 
     speedY = 2 
     go_right = 1 
     go_left = 2 
     direction_change = 0 

     # MAIN EVENT LOOP 
     while True: 

      # Event testing loop 

      for event in pygame.event.get(): 
       #print(event) 

       #condition to exit 
       if event.type == pygame.QUIT: sys.exit() 

       # Conditions for handling the paddle 

       # Test if a key is pressed 
       if event.type == KEYUP: 
        # If not, paddle not moving, ball direction uneffected 
        change_direction = False 
       if event.type == pygame.KEYDOWN: 

        # See which key is pressed 
        # If yes, paddle moving, change ball direction accordingly 
        if event.key == pygame.K_RIGHT: 
         change_direction = True 
         # make variable for which way to change direction 
         direction_change = go_right 
         # This Condition keeps the paddle on screen 
         if self.padle_pos[0] > self.width-self.padle_size[0]: 
          self.padle_pos[0]+=0 
         else: 
          self.padle_pos[0] += 5 

        # Same as previous If nest, but opposit direction 
        if event.key == pygame.K_LEFT: 
         change_direction = True 
         direction_change = go_left 
         if self.padle_pos[0] < 0: 
          self.padle_pos[0]+=0 
         else: 
          self.padle_pos[0] -= 5 

        # Pause game key (p), press (c) to continue. 
        # see paused() method 
        if event.key == K_p: 
         self.pause = True 
         self.paused() 


      # Put the paddle on screen 
      paddle = self.paddle() 

      # Ignore 
      #self.movePaddle() 

      if self.num_lives == 0: 

       print('='*30,'\n','='*30) 
       #self.pause = True 
       #self.paused() 
       self.gameOver() 

      # Move Ball 

      #print (self.speed) 
      # This is the Pygame function that makes the ball move 
      self.ballrect = self.ballrect.move(self.speed) 

      # Test if ball hits wall, cieling or floor and inverts direction 
      if self.ballrect.left < 0 or self.ballrect.right > self.width: 
       self.speed[0] = -self.speed[0] 
       print("hit side",self.speed) 

      if self.ballrect.top < 0 or self.ballrect.bottom > self.height: 
       self.speed[1] = -self.speed[1] 

      # Print speed at top screen bounce for debugging 
      if self.ballrect.top < 0: 
       print('hit top ', self.speed) 


      # Yay pygame collision testing 
      # Test if ball collides with paddle 
      if self.ballrect.colliderect(paddle): 
       print('good hit') 
       pygame.mixer.Sound.play(self.pong) 

       # Conditions for how to adjust ball speed `self.speed` var 
       # Should adujust speed AND invert direction 
       # Currently not working properly, However I do have it working 
       # much better now and not quite as worried. 

        # 1) When moving left, ball sometimes is not inverted (bounced 
        # up) and life is lost, Ball usually goes throug paddle and often 
        # becomes stuck and game ends immediatly. 

        # 2) Occasionally ball inverts in wrong direction???? 
        # switch from -1>>0>>1 and visa versa is probably 
        # creating something wierd here. 

        # 3) Speed Fluctuates seemingly at random, could be lag 
        # 
        # 

       if change_direction is True: 
        print('change direction', self.speed) 
        # Changes the X coordinate in speed to a negative (inverts) 
        #print(self.speed) 

        if direction_change == go_right: 
         speedX += 1 
         speedY -= 1 
         self.speed = [speedX, speedY] 
         direction_change = 0 
         print('change right', self.speed) 

        elif direction_change == go_left: 
         speedX -= 1 
         speedY += 1 
         self.speed = [speedX, speedY] 
         direction_change = 0 
         print('change left', self.speed) 

        else: self.speed = self.speed 
        # This is what creates the bounce effect 
        self.speed[1] = -self.speed[1] 
        print('after bounce', self.speed) 

       else: 
        self.speed[1] = -self.speed[1] 
        print('direction constant', self.speed) 

      # Life lost if ball hits bottom of screen 
      if self.ballrect.bottom > self.height: 
       print('hit bottom',self.speed) 
       self.num_lives-=1 
       print(self.num_lives) 


      self.moveBall() 

game = game() 
game.game_loop() 

這裏是開行到標準錯誤輸出:

*** Error in 'python3': double free or corruption (top): 0x0000000000f20d90 ***

當我在我的文件的第34行註釋掉
self.pong = pygame.mixer.Sound("pingpong.wav") 此錯誤不會occure

然後有一個非常長的回溯,和一個更長的'記憶圖'

在錯誤的最後一行與

Aborted (core dumped)

以下是完整的錯誤結束:

*** Error in `python3': double free or corruption (top): 0x0000000000f20d90 *** 
======= Backtrace: ========= 
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f430a5b07e5] 
/lib/x86_64-linux-gnu/libc.so.6(+0x7fe0a)[0x7f430a5b8e0a] 
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f430a5bc98c] 
/lib/x86_64-linux-gnu/libc.so.6(fclose+0x103)[0x7f430a5a6363] 
/usr/local/lib/python3.5/dist-packages/pygame/.libs/libSDL-1-9a9431b0.2.so.0.11.4(+0xf539)[0x7f4308b18539] 
/usr/local/lib/python3.5/dist-packages/pygame/.libs/libSDL_mixer-1-ec459934.2.so.0.12.0(Mix_LoadWAV_RW+0xe6)[0x7f4304288da6] 
/usr/local/lib/python3.5/dist-packages/pygame/mixer.cpython-35m-x86_64-linux-gnu.so(+0x4626)[0x7f4301762626] 
python3[0x55d17c] 
python3(PyObject_Call+0x47)[0x5b7167] 
python3(PyEval_EvalFrameEx+0x4f06)[0x528d06] 
python3(PyEval_EvalCodeEx+0x13b)[0x52e12b] 
python3[0x4ebcc3] 
python3(PyObject_Call+0x47)[0x5b7167] 
python3[0x4f413e] 
python3(PyObject_Call+0x47)[0x5b7167] 
python3[0x54d359] 
python3[0x55d17c] 
python3(PyObject_Call+0x47)[0x5b7167] 
python3(PyEval_EvalFrameEx+0x4f06)[0x528d06] 
python3[0x52d2e3] 
python3(PyEval_EvalCode+0x1f)[0x52dfdf] 
python3[0x5fd2c2] 
python3(PyRun_FileExFlags+0x9a)[0x5ff76a] 
python3(PyRun_SimpleFileExFlags+0x1bc)[0x5ff95c] 
python3(Py_Main+0x456)[0x63e7d6] 
python3(main+0xe1)[0x4cfe41] 
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f430a559830] 
python3(_start+0x29)[0x5d5f29] 
======= Memory map: ======== 
00400000-007a8000 r-xp 00000000 08:01 50596143       /usr/bin/python3.5 
009a8000-009aa000 r--p 003a8000 08:01 50596143       /usr/bin/python3.5 
009aa000-00a41000 rw-p 003aa000 08:01 50596143       /usr/bin/python3.5 
00a41000-00a72000 rw-p 00000000 00:00 0 
00cec000-00f2c000 rw-p 00000000 00:00 0         [heap] 
7f42e0000000-7f42e0021000 rw-p 00000000 00:00 0 
7f42e0021000-7f42e4000000 ---p 00000000 00:00 0 
7f42e8000000-7f42e8021000 rw-p 00000000 00:00 0 
7f42e8021000-7f42ec000000 ---p 00000000 00:00 0 
7f42ef7fe000-7f42ef7ff000 ---p 00000000 00:00 0 
7f42ef7ff000-7f42effff000 rw-p 00000000 00:00 0 
7f42effff000-7f42f4000000 rw-s 00000000 00:14 10       /dev/shm/pulse-shm-2867672065 
7f42f4000000-7f42f4021000 rw-p 00000000 00:00 0 
7f42f4021000-7f42f8000000 ---p 00000000 00:00 0 
7f42f83d7000-7f42f83d8000 ---p 00000000 00:00 0 
7f42f83d8000-7f42f8bd8000 rw-p 00000000 00:00 0 
7f42f8bd8000-7f42fcbd9000 rw-s 00000000 00:14 24       /dev/shm/pulse-shm-591135841 
7f42fcbd9000-7f42fcbdf000 r-xp 00000000 08:01 50858238     /usr/lib/x86_64-linux-gnu/alsa-lib/libasound_module_pcm_pulse.so 
7f42fcbdf000-7f42fcdde000 ---p 00006000 08:01 50858238     /usr/lib/x86_64-linux-gnu/alsa-lib/libasound_module_pcm_pulse.so 
7f42fcdde000-7f42fcddf000 r--p 00005000 08:01 50858238     /usr/lib/x86_64-linux-gnu/alsa-lib/libasound_module_pcm_pulse.so 
7f42fcddf000-7f42fcde0000 rw-p 00006000 08:01 50858238     /usr/lib/x86_64-linux-gnu/alsa-lib/libasound_module_pcm_pulse.so 
7f42fcde0000-7f42fce0a000 r-xp 00000000 08:01 50602882     /usr/lib/x86_64-linux-gnu/libvorbis.so.0.4.8 
7f42fce0a000-7f42fd00a000 ---p 0002a000 08:01 50602882     /usr/lib/x86_64-linux-gnu/libvorbis.so.0.4.8 
7f42fd00a000-7f42fd00b000 r--p 0002a000 08:01 50602882     /usr/lib/x86_64-linux-gnu/libvorbis.so.0.4.8 
7f42fd00b000-7f42fd00c000 rw-p 0002b000 08:01 50602882     /usr/lib/x86_64-linux-gnu/libvorbis.so.0.4.8 
7f42fd00c000-7f42fd013000 r-xp 00000000 08:01 50602534     /usr/lib/x86_64-linux-gnu/libogg.so.0.8.2 
7f42fd013000-7f42fd213000 ---p 00007000 08:01 50602534     /usr/lib/x86_64-linux-gnu/libogg.so.0.8.2 
7f42fd213000-7f42fd214000 r--p 00007000 08:01 50602534     /usr/lib/x86_64-linux-gnu/libogg.so.0.8.2 
7f42fd214000-7f42fd215000 rw-p 00008000 08:01 50602534     /usr/lib/x86_64-linux-gnu/libogg.so.0.8.2 
7f42fd215000-7f42fd227000 r-xp 00000000 08:01 44568911     /lib/x86_64-linux-gnu/libgpg-error.so.0.17.0 
7f42fd227000-7f42fd427000 ---p 00012000 08:01 44568911     /lib/x86_64-linux-gnu/libgpg-error.so.0.17.0 
7f42fd427000-7f42fd428000 r--p 00012000 08:01 44568911     /lib/x86_64-linux-gnu/libgpg-error.so.0.17.0 
7f42fd428000-7f42fd429000 rw-p 00013000 08:01 44568911     /lib/x86_64-linux-gnu/libgpg-error.so.0.17.0 
7f42fd429000-7f42fd440000 r-xp 00000000 08:01 44564672     /lib/x86_64-linux-gnu/libresolv-2.23.so 
7f42fd440000-7f42fd640000 ---p 00017000 08:01 44564672     /lib/x86_64-linux-gnu/libresolv-2.23.so 
7f42fd640000-7f42fd641000 r--p 00017000 08:01 44564672     /lib/x86_64-linux-gnu/libresolv-2.23.so 
7f42fd641000-7f42fd642000 rw-p 00018000 08:01 44564672     /lib/x86_64-linux-gnu/libresolv-2.23.so 
7f42fd642000-7f42fd644000 rw-p 00000000 00:00 0 
7f42fd644000-7f42fd6d1000 r-xp 00000000 08:01 50602884     /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2.0.11 
7f42fd6d1000-7f42fd8d0000 ---p 0008d000 08:01 50602884     /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2.0.11 
7f42fd8d0000-7f42fd8ec000 r--p 0008c000 08:01 50602884     /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2.0.11 
7f42fd8ec000-7f42fd8ed000 rw-p 000a8000 08:01 50602884     /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2.0.11 
7f42fd8ed000-7f42fd960000 r-xp 00000000 08:01 50601479     /usr/lib/x86_64-linux-gnu/libFLAC.so.8.3.0 
7f42fd960000-7f42fdb60000 ---p 00073000 08:01 50601479     /usr/lib/x86_64-linux-gnu/libFLAC.so.8.3.0 
7f42fdb60000-7f42fdb61000 r--p 00073000 08:01 50601479     /usr/lib/x86_64-linux-gnu/libFLAC.so.8.3.0 
7f42fdb61000-7f42fdb62000 rw-p 00074000 08:01 50601479     /usr/lib/x86_64-linux-gnu/libFLAC.so.8.3.0 
7f42fdb62000-7f42fdb78000 r-xp 00000000 08:01 44564667     /lib/x86_64-linux-gnu/libnsl-2.23.so 
7f42fdb78000-7f42fdd77000 ---p 00016000 08:01 44564667     /lib/x86_64-linux-gnu/libnsl-2.23.so 
7f42fdd77000-7f42fdd78000 r--p 00015000 08:01 44564667     /lib/x86_64-linux-gnu/libnsl-2.23.so 
7f42fdd78000-7f42fdd79000 rw-p 00016000 08:01 44564667     /lib/x86_64-linux-gnu/libnsl-2.23.so 
7f42fdd79000-7f42fdd7b000 rw-p 00000000 00:00 0 
7f42fdd7b000-7f42fde53000 r-xp 00000000 08:01 44568780     /lib/x86_64-linux-gnu/libgcrypt.so.20.0.5 
7f42fde53000-7f42fe052000 ---p 000d8000 08:01 44568780     /lib/x86_64-linux-gnu/libgcrypt.so.20.0.5 
7f42fe052000-7f42fe053000 r--p 000d7000 08:01 44568780     /lib/x86_64-linux-gnu/libgcrypt.so.20.0.5 
7f42fe053000-7f42fe05b000 rw-p 000d8000 08:01 44568780     /lib/x86_64-linux-gnu/libgcrypt.so.20.0.5 
7f42fe05b000-7f42fe05c000 rw-p 00000000 00:00 0 
7f42fe05c000-7f42fe07d000 r-xp 00000000 08:01 44568934     /lib/x86_64-linux-gnu/liblzma.so.5.0.0 
7f42fe07d000-7f42fe27c000 ---p 00021000 08:01 44568934     /lib/x86_64-linux-gnu/liblzma.so.5.0.0 
7f42fe27c000-7f42fe27d000 r--p 00020000 08:01 44568934     /lib/x86_64-linux-gnu/liblzma.so.5.0.0 
7f42fe27d000-7f42fe27e000 rw-p 00021000 08:01 44568934     /lib/x86_64-linux-gnu/liblzma.so.5.0.0 
7f42fe27e000-7f42fe29d000 r-xp 00000000 08:01 44569025     /lib/x86_64-linux-gnu/libselinux.so.1 
7f42fe29d000-7f42fe49c000 ---p 0001f000 08:01 44569025     /lib/x86_64-linux-gnu/libselinux.so.1 
7f42fe49c000-7f42fe49d000 r--p 0001e000 08:01 44569025     /lib/x86_64-linux-gnu/libselinux.so.1 
7f42fe49d000-7f42fe49e000 rw-p 0001f000 08:01 44569025     /lib/x86_64-linux-gnu/libselinux.so.1 
7f42fe49e000-7f42fe4a0000 rw-p 00000000 00:00 0 
7f42fe4a0000-7f42fe4a5000 r-xp 00000000 08:01 50601729     /usr/lib/x86_64-linux-gnu/libasyncns.so.0.3.1 
7f42fe4a5000-7f42fe6a4000 ---p 00005000 08:01 50601729     /usr/lib/x86_64-linux-gnu/libasyncns.so.0.3.1 
7f42fe6a4000-7f42fe6a5000 r--p 00004000 08:01 50601729     /usr/lib/x86_64-linux-gnu/libasyncns.so.0.3.1 
7f42fe6a5000-7f42fe6a6000 rw-p 00005000 08:01 50601729     /usr/lib/x86_64-linux-gnu/libasyncns.so.0.3.1 
7f42fe6a6000-7f42fe708000 r-xp 00000000 08:01 50602736     /usr/lib/x86_64-linux-gnu/libsndfile.so.1.0.25 
7f42fe708000-7f42fe908000 ---p 00062000 08:01 50602736     /usr/lib/x86_64-linux-gnu/libsndfile.so.1.0.25 
7f42fe908000-7f42fe90a000 r--p 00062000 08:01 50602736     /usr/lib/x86_64-linux-gnu/libsndfile.so.1.0.25 
7f42fe90a000-7f42fe90b000 rw-p 00064000 08:01 50602736     /usr/lib/x86_64-linux-gnu/libsndfile.so.1.0.25 
7f42fe90b000-7f42fe90f000 rw-p 00000000 00:00 0 
7f42fe90f000-7f42fe917000 r-xp 00000000 08:01 44569053     /lib/x86_64-linux-gnu/libwrap.so.0.7.6 
7f42fe917000-7f42feb16000 ---p 00008000 08:01 44569053     /lib/x86_64-linux-gnu/libwrap.so.0.7.6 
7f42feb16000-7f42feb17000 r--p 00007000 08:01 44569053     /lib/x86_64-linux-gnu/libwrap.so.0.7.6 
7f42feb17000-7f42feb18000 rw-p 00008000 08:01 44569053     /lib/x86_64-linux-gnu/libwrap.so.0.7.6 
7f42feb18000-7f42feb19000 rw-p 00000000 00:00 0 
7f42feb19000-7f42feb99000 r-xp 00000000 08:01 44564494     /lib/x86_64-linux-gnu/libsystemd.so.0.14.0 
7f42feb99000-7f42feb9c000 r--p 0007f000 08:01 44564494     /lib/x86_64-linux-gnu/libsystemd.so.0.14.0 
7f42feb9c000-7f42feb9d000 rw-p 00082000 08:01 44564494     /lib/x86_64-linux-gnu/libsystemd.so.0.14.0 
7f42feb9d000-7f42feb9e000 rw-p 00000000 00:00 0 
7f42feb9e000-7f42febe8000 r-xp 00000000 08:01 44564740     /lib/x86_64-linux-gnu/libdbus-1.so.3.14.6 
7f42febe8000-7f42fede8000 ---p 0004a000 08:01 44564740     /lib/x86_64-linux-gnu/libdbus-1.so.3.14.6 
7f42fede8000-7f42fede9000 r--p 0004a000 08:01 44564740     /lib/x86_64-linux-gnu/libdbus-1.so.3.14.6 
7f42fede9000-7f42fedea000 rw-p 0004b000 08:01 44564740     /lib/x86_64-linux-gnu/libdbus-1.so.3.14.6 
7f42fedea000-7f42fee63000 r-xp 00000000 08:01 50858971     /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-8.0.so 
7f42fee63000-7f42ff062000 ---p 00079000 08:01 50858971     /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-8.0.so 
7f42ff062000-7f42ff063000 r--p 00078000 08:01 50858971     /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-8.0.so 
7f42ff063000-7f42ff064000 rw-p 00079000 08:01 50858971     /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-8.0.so 
7f42ff064000-7f42ff06e000 r-xp 00000000 08:01 44568926     /lib/x86_64-linux-gnu/libjson-c.so.2.0.0 
7f42ff06e000-7f42ff26d000 ---p 0000a000 08:01 44568926     /lib/x86_64-linux-gnu/libjson-c.so.2.0.0 
7f42ff26d000-7f42ff26e000 r--p 00009000 08:01 44568926     /lib/x86_64-linux-gnu/libjson-c.so.2.0.0 
7f42ff26e000-7f42ff26f000 rw-p 0000a000 08:01 44568926     /lib/x86_64-linux-gnu/libjson-c.so.2.0.0 
7f42ff26f000-7f42ff2bd000 r-xp 00000000 08:01 50602624     /usr/lib/x86_64-linux-gnu/libpulse.so.0.19.0 
7f42ff2bd000-7f42ff4bc000 ---p 0004e000 08:01 50602624     /usr/lib/x86_64-linux-gnu/libpulse.so.0.19.0 
7f42ff4bc000-7f42ff4bd000 r--p 0004d000 08:01 50602624     /usr/lib/x86_64-linux-gnu/libpulse.so.0.19.0 
7f42ff4bd000-7f42ff4be000 rw-p 0004e000 08:01 50602624     /usr/lib/x86_64-linux-gnu/libpulse.so.0.19.0 
7f42ff6c0000-7f42ff7b9000 r-xp 00000000 08:01 50601719     /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0 
7f42ff7b9000-7f42ff9b8000 ---p 000f9000 08:01 50601719     /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0 
7f42ff9b8000-7f42ff9bf000 r--p 000f8000 08:01 50601719     /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0 
7f42ff9bf000-7f42ff9c0000 rw-p 000ff000 08:01 50601719     /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0 
7f42ff9c0000-7f42ff9c5000 r-xp 00000000 08:01 50601642     /usr/lib/x86_64-linux-gnu/libXfixes.so.3.1.0 
7f42ff9c5000-7f42ffbc4000 ---p 00005000 08:01 50601642     /usr/lib/x86_64-linux-gnu/libXfixes.so.3.1.0 
7f42ffbc4000-7f42ffbc5000 r--p 00004000 08:01 50601642     /usr/lib/x86_64-linux-gnu/libXfixes.so.3.1.0 
7f42ffbc5000-7f42ffbc6000 rw-p 00005000 08:01 50601642     /usr/lib/x86_64-linux-gnu/libXfixes.so.3.1.0 
7f42ffbc6000-7f42ffbcf000 r-xp 00000000 08:01 50601660     /usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0 
7f42ffbcf000-7f42ffdce000 ---p 00009000 08:01 50601660     /usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0 
7f42ffdce000-7f42ffdcf000 r--p 00008000 08:01 50601660     /usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0 
7f42ffdcf000-7f42ffdd0000 rw-p 00009000 08:01 50601660     /usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0 
7f42ffdd0000-7f42ffdd9000 r-xp 00000000 08:01 50601634     /usr/lib/x86_64-linux-gnu/libXcursor.so.1.0.2 
7f42ffdd9000-7f42fffd8000 ---p 00009000 08:01 50601634     /usr/lib/x86_64-linux-gnu/libXcursor.so.1.0.2 
7f42fffd8000-7f42fffd9000 r--p 00008000 08:01 50601634     /usr/lib/x86_64-linux-gnu/libXcursor.so.1.0.2 
7f42fffd9000-7f42fffda000 rw-p 00009000 08:01 50601634     /usr/lib/x86_64-linux-gnu/libXcursor.so.1.0.2 
7f42fffda000-7f42fffeb000 r-xp 00000000 08:01 50601640     /usr/lib/x86_64-linux-gnu/libXext.so.6.4.0 
7f42fffeb000-7f43001ea000 ---p 00011000 08:01 50601640     /usr/lib/x86_64-linux-gnu/libXext.so.6.4.0 
7f43001ea000-7f43001eb000 r--p 00010000 08:01 50601640     /usr/lib/x86_64-linux-gnu/libXext.so.6.4.0 
7f43001eb000-7f43001ec000 rw-p 00011000 08:01 50601640     /usr/lib/x86_64-linux-gnu/libXext.so.6.4.0Aborted (core dumped) 

是什麼原因造成這種類型的錯誤,我會如何去修復它?

回答

0

這是因爲C代碼中的一個錯誤而發生的。如果你的程序是純Python,那麼你的錯誤就不會發生,並且你在Python或Pygame中發現了一個錯誤。您應該找到仍然存在該錯誤的儘可能最小的程序,然後進行報告。

+0

迷人,OK,然後我想這就是我會做什麼 –

+0

我應該在哪裏報告? –

+0

您是否將測試用例最小化?如果pygame調用是觸發它的關鍵,我會將它報告給pygame開發人員。 –

2

我通過使用不同類型的文件格式解決了這個問題。

根據pygame .wav.mp3文件在使用Ubuntu時崩潰pygame。

正確的文件類型在pygame中使用Ubuntu的是.ogg