舉例來說,我使用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我想在這個錯誤後程序繼續轉動 –