title: How to except SyntaxError?
body: <p>I would like to except the error the following code produces, but I don't know how.</p>
  
  <pre><code>from datetime import datetime
  
  try:
      date = datetime(2009, 12a, 31)
  except:
      print "error"
  </code></pre>
  
  <p>The code above is not printing <code>"error"</code>. That's what I would like to be able to do.</p>
  
  <p>edit: The reason I would like to check for syntax errors, is because 12a is a command line parameter.</p>
  
  <p>Thanks.</p>