0

我编写的代码正在清理存在错误 unicode 的特定 .db 文件。但是,我遇到了操作错误。代码是:

print("Fixing bad unicode on INVENTORYADJUSTMENTS")
query = 'UPDATE inventoryadj SET reason = "moved 27.5 back to this lot from 6033 4959 0000 0860 Purple Kush (purple kush 1 gram)10.0 ... 1g 6033 4959 0000 0861 Product1057 (product1057 3.5 grams)5.0 ... 3.50g because the store cancelled their order" WHERE reason LIKE "%moved 27.5 back%"'
c.execute(query)
query = 'UPDATE inventoryadj SET reason = ".5g returned from each (total 10g): 9856 6837 5184 3061 7950 7935 1299 1459 4877 8356 9570 8130 1662 9514 3129 8210 0307 1430 6662 1358 4690 8697 2164 4227 7919 7395 0302 5116 2313 2476 7020 5546 2236 1250 8521 7748 9615 5871 4513 1927 1901 6658 2143 3432 5156 8124 9798 9272 1514 3085 9914 1675 6445 7339 9597 9985 3959 4926 9875 7715 1220 8947 2849 7222 3178 3654 6722 0927 8254 7372 0695 3929 4570 5377 1809 8844 0728 4785 2862 2294" where reason LIKE "%5g returned from each (total 10g): 9856%"' 
c.execute(query)
query = "SELECT id, inventoryid, old, new, difference, sessiontime, transactionid, orgid, " + \
        sanitize('reason') + \
        ", atype, location, transactionid_original, inventory_time " + \
        " FROM inventoryadj " + \
        limit
querySave(query, c, 'inventoryadj')

我收到一个操作错误,提示“无法解码为带有文本的 utf-8 列原因”已移动...

我应该在这里错过什么?

4

0 回答 0