Hi I have a file and want to create the sqlite3 db. Using with however i receive an attribute error and it causes an exit.
The relevant section of the file is: import sqlite3 conn = sqlite3.connect("trial.db") with conn, conn.cursor() as cur: # First, create tables. cur.execute("drop table if exists meetings, races, horses") cur.execute("create table meetings (" + ", ".join("%s varchar" % fld for fld in meetattrs) + ")") cur.execute("create table races (" + ", ".join("%s varchar" % fld for fld in raceattrs) + ")") cur.execute("create table horses (" + ", ".join("%s varchar" % fld for fld in horseattrs) + ")") However it runs producing this error for line 30 which is with conn, conn.cursor() as cur: (pyXML) [sayth@manjaro pyXML]$ python racemeeting.py data/*xml Traceback (most recent call last): File "racemeeting.py", line 31, in <module> with conn, conn.cursor() as cur: AttributeError: __exit__ Why would i get this error? Sayth -- https://mail.python.org/mailman/listinfo/python-list