Catching Python exceptions using 'expect' method?
<pre><code>import sys
try:
     file = open("words.txt")
expect(IOError):

if file:
    print "%s" % file
else:
    print "Cant the %s file" % "words.txt"
</code></pre>

<p>this gives me an a error - </p>

<pre><code>File "main.py", line 4 
    expect(IOError):
    SyntaxError: invaild syntax
</code></pre>

<p>What im going wrong/ how do you fix this</p>
