I wrote a method that does some stuff and catches bad filenames. what should happen is if the path doesn't exist, it throws an IOError. however, it thinks my exception handling is bad syntax... why??

def whatever():
    try:
        # do stuff
        # and more stuff
    except IOError:
        # do this
        pass
whatever()

but before it even gets to calling whatever(), it prints the following:

Traceback (most recent call last):
  File "", line 1, in 
  File "getquizzed.py", line 55
    except IOError:
         ^
SyntaxError: invalid syntax

when imported...help?!
there's 1 more possible if you're privileged to have an older installation 
and
you're using the 'as' syntax:
     except IOError as ioe:
and
the parser's getting tripped up on 'as'.
Using as is the preferred syntax in Python 2.6 and better.
It's a syntax error in Python 2.5 and older.  For pre-2.6, use this:
     except IOError, ioe:
catching an IOError in python