title: Python database sqlite3
body: <p>I got a little program with my code below: </p>
  
  <pre><code>def get_code(hex_pattern, database='./AndroidLockScreenRainbow.sqlite'):
      try:
          if os.path.exists(database):
              with lite.connect(database) as db:
                  with db.cursor() as c:
                      c.execute("SELECT * FROM RainbowTable")
                      rows = c.fetchall()
                      for row in rows:
                          if row[0] == hex_pattern:
                              return row[1]
          else:
              raise lite.OperationalError("Database file not exists")
      except lite.OperationalError:
          print('Given SQL table not found!')
  </code></pre>
  
  <p>When the code reach the line with db.cursor() as c:, the program gives the following error</p>
  
  <blockquote>
  <pre><code>with db.cursor() as c:
  AttributeError: __exit__
  </code></pre>
  </blockquote>
  
  <p>What do I wrong? </p>