1

How do I play an MPs file in Python? I have tried

import os
os.system("start C:/thepathyouwant/file")

and every time I get the error: "couldn't locate file" I am working on a text based RPG, and I only want to add an MP3 file for music. I'm just starting out in Python, and don't know much about Pyglet. I attempted an install using the command line:

python setup.py install

In the "Run" window.

I also attempted to install pyglet.msi, but I recieved the error:

pyglet requires Python 2.4 or later. The installation will be aborted

running Python 2.7.9 running Windows 8

Thanks!

sloth
  • 99,095
  • 21
  • 171
  • 219
xxanteplynexx
  • 23
  • 1
  • 5

1 Answers1

0

You can use startfile function in os module to play your file.Consider this example:

import os
os.startfile('C:/Users/Aakash/Desktop/songs/Anime.mp3')
Aakash
  • 83
  • 1
  • 12