[Tutor] Python won't play wav file

Joseph Quigley cpu.crazy at gmail.com
Tue May 24 03:49:37 CEST 2005


I can't get:

import wave as w

def manipulate():
     manipulate = raw_input("Type 'help' for help\nManipulate>> ")
     if manipulate == "play":
         w.tell()
     elif manipulate == "back()":
         main_menu()

def open():
     while True:
         file_name = raw_input("Open: ")
         if file_name == "back()":
             break
         try:
             w.open(file_name, 'r')
         except IOError:
             print "Non-existant file."
         w.open(file_name, 'r')
         manipulate()

def main_menu():
     main_menu = raw_input("Type 'help' for help\n>> ")
     if main_menu == "open":
         open()
     elif main_menu == "help":
         import help
         help.main()

main_menu()

... to play a .wav music file. I tried w.play() but got an error that 
module has no attribute 'play'.
What do I use to get it to play?
Thanks,
	JQ



More information about the Tutor mailing list