title: Why does windows give an sqlite3.OperationalError and linux does not?
body: <h1>The problem</h1>
  
  <p>I've got a programm that uses <a href="http://storm.canonical.com" rel="nofollow noreferrer">storm 0.14</a> and it gives me this error on windows:</p>
  
  <pre>
  sqlite3.OperationError: database table is locked
  </pre>
  
  <p>The thing is, under linux it works correctly.</p>
  
  <p>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.</p>
  
  <p>Turning on the debug mode gives me this on windows:</p>
  
  <pre>
  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
  </pre>
  
  <p>On linux:</p>
  
  <pre>
  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
  </pre>
  
  <h1>System info</h1>
  
  <p><em>Windows</em></p>
  
  <ul>
  <li>Windows XP SP 3</li>
  <li>Python 2.5.4</li>
  <li>NTFS partition</li>
  </ul>
  
  <p><em>Linux</em></p>
  
  <ul>
  <li>Ubuntu 8.10</li>
  <li>Python 2.5.2</li>
  <li>ext3 partition</li>
  </ul>
  
  <h1>Some code</h1>
  
  <pre><code>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
  </code></pre>
  
  <h1>The question</h1>
  
  <p>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?</p>
  
  <h1>Another observation</h1>
  
  <p>When adding a <code>COMMIT</code> at the place where the error happens, this error is thrown instead: <code>sqlite3.OperationalError: cannot commit transaction - SQL statements in progress</code></p>
  
  <h1>Answers to answers</h1>
  
  <p>I'm not using multiple threads / processes, therefore concurrency shouldn't be a problem and also I've got only one Store object.</p>