Fatal Python error: (pygame parachute) when calling pygame.mixer.pre_init with a device name

Viewed 110

Environment: I am on macOS Mojave and installed the latest version of PyGame. I am running the code to install the terminal.

You can get some of this info from the text that pops up in the console when you run a pygame program.

  • Operating system MacOS Mojave.
  • Python version 3.7.6

When I run the following code to change the output device with a device name as follows:

import pygame
import pygame._sdl2 as sdl2
pygame.init()
names = [str(sdl2.get_audio_device_name(i, 0), encoding="utf-8") for i in range(num)]
dev_name = names[0] # device number 
pygame.mixer.pre_init(devicename= dev_name)

It returns the following error with the mac error message to quit python as in the screenshot below. I tried this with the string literals such as: "Sennheiser USB headset" or b'"Sennheiser USB headset" which are values returned from list "names" in above code. All of them return the same error as below.

image

Any help would be much appreciated.

1 Answers

I don't think you would require all this

import pygame._sdl2 as sdl2
pygame.init()
names = [str(sdl2.get_audio_device_name(i, 0), encoding="utf-8") for i in range(num)]
dev_name = names[0] # device number 
pygame.mixer.pre_init(devicename= dev_name)

Try this

import pygame
pygame.init() 
pygame.mixer.init()
Related