raise exception wave python
<p>I use the wave module
for  example .</p>

<pre><code>     import wave
     origAudio = wave.open("son.wav",'r')
</code></pre>

<p>get output </p>

<pre><code>       raise Error, 'file does not start with RIFF id'
       wave.Error: file does not start with RIFF id
</code></pre>

<p>I know the file is not good,but I want to raise this exception or this error</p>

<p>If you wish to continue after an expection has been raised you must catch it:</p>

<pre><code> 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
</code></pre>

python exception wave