python: raise exception if theres a none value encountered
<p>I want to use exception handling like this. but this throughs error ("SyntaxError: invalid syntax")</p>

<pre><code>try:
   protocol = serverInfo_D['protocol'] or raise KeyError("protocol not present")
except KeyError:
   print "server config is not proper"
</code></pre>

<p>Any other simple way to get the resutlt .. I want to keep the code simple.</p>

<p>UPDATE:</p>

<p>I am trying to use this if the value in array is None !! When the value is None I want the exception to raise.</p>
