Python Date Comparison throws an unexpected error
<p>I'm using a Flask/SqlAlchemy app with the google calendar API. Essentially, I'm creating a database of events. Here's a stripped-down class snippet: </p>

<pre><code># Flask. We just need the basic stuff in this common moduel
from flask import Flask

# flask SQLAlchemy
from flask.ext.sqlalchemy import SQLAlchemy

# Sort
from sqlalchemy import desc,asc,and_

# Datetime
from datetime import datetime, date



class FlyingEvent(db.Model):
    # Event Data
    event_id = db.Column(db.Text, primary_key=True)
    updated_datetime = db.Column(db.DateTime)
    start_date = db.Column(db.DateTime)
    end_date = db.Column(db.DateTime)
    status = db.Column(db.Text)
    creator_email = db.Column(db.Text)
    summary = db.Column(db.Text)
    description = db.Column(db.Text)

    # Flying-specific entries
    flying = db.Column(db.Boolean)
    tach_start = db.Column(db.Float)
    tach_end = db.Column(db.Float)


def extract_hours():
        def get_digits(line):
          if re.compare('[\d\.]+', line):
            return line
          else:
            return None
        try: 
          right_now=date.today()
          if self.flying and self.end_date.date() &lt; right_now:
            lines = self.description.split('\n')
            self.tach_start = get_digits(lines[0])
            self.tach_end = get_digits(lines[1])
        except Exception as e:
            raise Exception('%r, Could not parse tach %r %r' % (e, self, 
                right_now))
</code></pre>

<p>This raises an exception (which I reraise with the object's repr):</p>

<pre><code>Exception: AttributeError("'module' object has no attribute 'compare'",), Could not parse tach { "event_id": u'go8bl9i615f7e7qljuoun9bqgk', "update_datetime": datetime.datetime(2013, 4, 12, 23, 58, 54, 371000), "start_date": datetime.datetime(2013, 4, 4, 0, 0), "end_date": datetime.datetime(2013, 4, 5, 0, 0), "status": u'confirmed',        "creator_email": u'jordanzaretsky@gmail.com', "summary": u'jordan 10.6 to 10.9', "description": u'1010.7\n1010.9', "flying": True, "tach_start": 1010.7, "tach_end": 1010.9} datetime.date(2013, 4, 14)
</code></pre>

<p>It seems to me that the self.end_date is a datetime object (which I'm taking the .date() of), and right_now is a datetime.date(). </p>

<p>What am I missing? </p>
