# -*- coding: cp1251 -*-
import sys, time
import sqlite3 as db
ifile = open("invent.txt", 'r')
c = db.connect(database=r"C:\pythonprog\txt\goodsinvent.s3db")
cu = c.cursor()
#cu.execute("DELETE FROM goods")
for line in ifile.readlines():
f = line.split('\t').decode('utf-8')
try:
cu.execute("INSERT INTO goods VALUES (?, ?, ?, ?, ?)", (f[0], f[2], f[3], f[4], f[6]))
except db.DatabaseError, x:
print "Ошибка: ", x
cu.execute("SELECT * FROM goods ORDER BY plu ASC")
c.commit()
c.close()
ifile.close()
Traceback (most recent call last):
File "C:\pythonprog\txt\filesort.py", line 14, in <module>
cu.execute("SELECT * FROM goods ORDER BY plu ASC")
OperationalError: Could not decode to UTF-8 column 'ProdGoup' with text 'Продуктовые товары
Честно говоря не догоняю.