Debug s3.py for UnboundLocalError 

It raises UnboudLocalError for accessing e without naming your exception.