Re: Unable to close due to unfinalised statements error msg
Gerhard Häring <[email protected]>
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
jim roush wrote: > On 5/2/07, *Gerhard Häring* <[email protected] <mailto:[email protected]>> wrote: > > jim roush wrote: > > I'm geting the following error message shown below. The relevant > > section of code follows that. Anyone have any ideas? > > > > Traceback (most recent call last): > > File "C:\markets\source\QuantScan\test.py", line 255, in <module> > > db.close() > > sqlite3.OperationalError: Unable to close due to unfinalised > statements > > [...] > > Which pysqlite version is this? [...] > I knew this problem could occur with older versions, but it should not > occur any more with current versions. > > '2.3.2' Ok, I found that strange - very strange. But after a bit of thinking and looking through the code, I found a scenario how you could provoke that error: from pysqlite2 import dbapi2 as sqlite con = sqlite.connect(":memory:") cursors = [] # default statement cache size is 100 for i in range(105): cur = con.cursor() cursors.append(cur) cur.execute("select 1 x union select " + str(i)) con.close() I'll try to find a fix. In the meantime, you can make sure that you close or del your cursors before you try to close the connection. This should help. -- Gerhard