例如,我使用了波模块。
import wave
origAudio = wave.open("son.wav",'r')获得输出
raise Error, 'file does not start with RIFF id'
wave.Error: file does not start with RIFF id我知道这个文件不好,但是我想引发这个异常或者这个错误。
发布于 2016-09-16 13:48:23
如果你想在提出期望之后继续下去,你必须抓住它:
import wave
try:
origAudio = wave.open("son.wav",'r')
except wave.Error as e:
# if you get here it means an error happende, maybe you should warn the user
# but doing pass will silently ignore it
passhttps://stackoverflow.com/questions/39532555
复制相似问题