为什么Windows会给出sqlite3.OperationalError而Linux没有? [英] Why does windows give an sqlite3.OperationalError and linux does not?
问题描述
我有一个使用风暴0.14 的程序,它在Windows上给了我这个错误:>
I've got a programm that uses storm 0.14 and it gives me this error on windows:
sqlite3.OperationError: database table is locked
问题是,在Linux下它可以正常工作.
The thing is, under linux it works correctly.
我的印象是,只有在进行了一定数量的更改后,它才会发生,就像在某些代码中那样,它会复制很多对象.
I've got the impression that it happens only after a certain amount of changes have been done, as it happens in some code, that copies a lot of objects.
打开调试模式可以在Windows上看到:
Turning on the debug mode gives me this on windows:
83 EXECUTE: 'UPDATE regularorder_product SET discount=? WHERE regularorder_product.order_id = ? AND regularorder_product.product_id = ?', (Decimal("25.00"), 788, 274)
84 DONE
85 EXECUTE: 'UPDATE repeated_orders SET nextDate=? WHERE repeated_orders.id = ?', (datetime.date(2009, 3, 31), 189)
86 ERROR: database table is locked
在linux上:
83 EXECUTE: 'UPDATE regularorder_product SET discount=? WHERE regularorder_product.order_id = ? AND regularorder_product.product_id = ?', (Decimal("25.00"), 789, 274)
84 DONE
85 EXECUTE: 'UPDATE repeated_orders SET nextDate=? WHERE repeated_orders.id = ?', (datetime.date(2009, 3, 31), 189)
86 DONE
系统信息
Windows
- Windows XP SP 3
- Python 2.5.4
- NTFS分区
Linux
- Ubuntu 8.10
- Python 2.5.2
- ext3分区
def createRegularOrderCopy(self):
newOrder = RegularOrder()
newOrder.date = self.nextDate
# the exception is thrown on the next line,
# while calling self.products.__iter__
# this happens when this function is invoked the second time
for product in self.products:
newOrder.customer = self.customer
newOrder.products.add(product)
return newOrder
orders = getRepeatedOrders(date)
week = timedelta(days=7)
for order in orders:
newOrder = order.createRegularOrderCopy()
store.add(newOrder)
order.nextDate = date + week
问题
关于sqlite3/python,在Windows和Linux之间是否有区别?该错误的原因可能是什么,我该如何解决?
The question
Is there anything about sqlite3/python that differs between windows and linux? What could be the reason for this bug and how can I fix it?
在发生错误的位置添加COMMIT
时,将引发此错误:sqlite3.OperationalError: cannot commit transaction - SQL statements in progress
When adding a COMMIT
at the place where the error happens, this error is thrown instead: sqlite3.OperationalError: cannot commit transaction - SQL statements in progress
我没有使用多个线程/进程,因此并发应该不是问题,而且我只有一个Store对象.
I'm not using multiple threads / processes, therefore concurrency shouldn't be a problem and also I've got only one Store object.
推荐答案
目前,我已经通过用最新版本替换sqlite3-dll解决了该问题.我仍然不确定这是否是sqlite的Windows代码中的错误,还是python是否在Windows上安装了比Linux上的旧版本.
I've solved the problem at the moment by replacing the sqlite3-dll with the newest version. I'm still not sure if this was a bug in the windows code of sqlite or if python installed an older version on windows than on linux.
感谢您的帮助.
这篇关于为什么Windows会给出sqlite3.OperationalError而Linux没有?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!