import pygame pygame.init() pygame.cdrom.init() cd = pygame.cdrom.CD(0) cd.init() while True: cd.eject() print("XD")