title: TypeError: can't compare datetime.time to tuple
body: <p>I working on my BAC Project. I would like query time from my MySQL database. With this time which is my database, I would like compare it with the real time. I begin with Python language so... </p>
  
  <p>[here it's my database][<a href="https://i.stack.imgur.com/ROxnQ.png]" rel="nofollow noreferrer">https://i.stack.imgur.com/ROxnQ.png]</a></p>
  
  <p>Here is my code but I have an error "TypeError: can't compare datetime.time to tuple" </p>
  
  <pre><code>import RPi.GPIO as GPIO
  import time
  import datetime
  import MySQLdb
  
  
  GPIO.setmode(GPIO.BOARD)
  GPIO.setup(40, GPIO.OUT)
  GPIO.setup(38, GPIO.OUT)
  
  db = MySQLdb.connect(host="localhost",    # your host, usually localhost
                      user="root",         # your username
                     passwd="Orel_27130",  # your password
                      db="projet")        # name of the data base
  
  
  
  
  while True:
      now = datetime.datetime.time(datetime.datetime.now())
      print (now)
      print time.strftime("%H:%M:%S")
      cursor = db.cursor()
      cursor.execute("SELECT time_open FROM time WHERE id = 2")
      time_open = cursor.fetchall()
      print time_open
      if time_open &lt; now:
          print ("Fermee")
          GPIO.output(38, False)
          GPIO.output(40, True)
      else:
          print ("Ouvert")
          GPIO.output(38, True)
          GPIO.output(40, False)
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>((datetime.datetime(2017, 1, 23, 13, 0),),)
  Traceback (most recent call last):
    File "mysql.py", line 27, in &lt;module&gt;
      if time_open &lt; now:
  TypeError: can't compare datetime.time to tuple
  </code></pre>