Re: Unable to close due to unfinalised statements error msg

"Witold Czarnecki" <[email protected]>
Newsgroups gmane.comp.python.db.pysqlite.user
Organization Traffiqua
Message-ID <op.trjls2t5u10rxn@lenovo-baf1afe5>
I suggest to change the order to:

db.commit()
cur.close()
db.close()

On Sun, 29 Apr 2007 11:09:03 +0200, jim roush <[email protected]> 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
>
>
>     # update ROC table in db
>     print '\nupdate ROC table in db...\n'
>     cur = db.cursor()
>     cur.execute("delete from subind_ROC")
>
>     for row in range(0, num_of_subinds):
>         (subind, si_ROC_10, si_ROC_10_1, si_ROC_10_2, si_ROC_20,
> si_ROC_20_1, \
>             si_ROC_20_2, si_ROC_30, si_ROC_30_1, si_ROC_30_2) =  
> si_ROC[row]
>
>         cur.execute("INSERT INTO subind_ROC (subind, ROC_10, ROC_10_1, \
>             ROC_10_2, ROC_20, ROC_20_1, ROC_20_2, ROC_30, ROC_30_1, \
>             ROC_30_2) Values (?,?,?,?,?,?,?,?,?,?)", \
>             (subind, si_ROC_10, si_ROC_10_1, si_ROC_10_2, si_ROC_20, \
>             si_ROC_20_1, si_ROC_20_2, si_ROC_30, si_ROC_30_1,  
> si_ROC_30_2))
>
>     top_25()
>
>     cur.close()
>     db.commit()
>     db.close()
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.