In Python with sqlite is it necessary to close a cursor?

It’s probably a good idea (although it might not matter much with sqlite, don’t know there, but it’ll make your code more portable). Further, with recent Python (2.5+), it’s easy:

from __future__ import with_statement
from contextlib import closing

with closing(db.cursor()) as cursor:
    # do some stuff

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)