举例来说,我使用wave模块 。提升异常波形python
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
我知道文件是不是不好,但我想提出这个异常或此错误
举例来说,我使用wave模块 。提升异常波形python
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
我知道文件是不是不好,但我想提出这个异常或此错误
如果您希望继续之后的厚望已经提升你必须抓住它:
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
pass
已经为您提出异常'错误'。你的意思是抓住并重新制定一个不同的? – RedX
@RedX我想在这个错误后程序继续转动 –