PyInstallerでコンパイルするまで、次の関数はうまく動作します。 "エラーバインディングパラメータ0.おそらくサポートされていないタイプです。"エラーを示す行は "cur.execute"行です。私はPyinstallerのドキュメントをチェックしましたが、この問題に関連するものは見つかりませんでした。私はPython 2.7を使用しています。Pyinstallerを実行した後、Sqlite3 update query breaks
更新** Iron Pythonとコンソールpython2.7の間に何らかの非互換性があることを絞りました。私はPython(x、y)パッケージとSpyder2 IDEを使ってプログラムを開発しました。私はIron Pythonコンソールでプログラムを実行しました。私はまた、通常のPythonコンソールで実行しているときに上記の問題に遭遇し、同じエラーが発生しました。問題はPyinstallerではなく、IPとPython2.7の間に何らかの非互換性があります。私はまだ研究しているので誰かが答えを持っているなら、私に知らせてください。
def update_clients(self):
#Get client id from list
cid = None
try:
cid = self.client_list_id()
except:
QtGui.QMessageBox.warning(self, 'Warning', 'You must first select a client before you update')
if cid:
#Get update items
first = self.lineEdit_c_first.text()
last = self.lineEdit_c_last.text()
add1 = self.lineEdit_c_address1.text()
add2 = self.lineEdit_c_address2.text()
city = self.lineEdit_c_city.text()
state = self.lineEdit_c_state.text()
zipp = self.lineEdit_c_zip.text()
phone = self.lineEdit_c_phone.text()
cell = self.lineEdit_c_phone_cell.text()
off = self.lineEdit_c_phone_office.text()
email = self.lineEdit_c_email.text()
notes = self.textEdit_c_notes.toPlainText()
#Update database
conn = sqlite3.connect('gibbs.db')
cur = conn.cursor()
sql = ("""
UPDATE clients
SET
firstname = ?,
lastname = ?,
address1 = ?,
address2 = ?,
city = ?,
state = ?,
zip = ?,
phone = ?,
officephone = ?,
cell = ?,
email = ?,
notes = ?
WHERE rowid = ?
""")
cur.execute(sql, (first, last, add1, add2, city, state, zipp, phone, off, cell, email, notes, cid,))
conn.commit()
conn.close()
QtGui.QMessageBox.information(self, 'Success', 'Database successfully updated')
表は、データ型を示す以下のコードで作成されました。出力は2つのconsoles.The鉄のPythonコンソール出力に異なっていただけで、クエリの前にラインprint type(first)
を追加し、プログラムを実行した後
def create_clients():
try:
conn = create_connection()
print conn
c = conn.cursor()
c.execute("""
CREATE TABLE clients (
id INTEGER PRIMARY KEY,
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP,
firstname TEXT,
lastname TEXT,
address1 TEXT,
address2 TEXT,
city TEXT,
state TEXT,
zip TEXT,
phone TEXT,
officephone TEXT,
cell TEXT,
email TEXT,
notes TEXT
)
""")
conn.close()
except:
print "table already exists"
まず、 'cur.execute'の直前に、' print repr(first) 'やそれに類するものを追加することです。 – 9000