Скрипт правильно читает строки, но он не может прогрессировать и вставляться в БД.
Это мой домашний проект. Я использую RasPi 3 ModelB +.
a = input('Scan Card: ')
now = datetime.strftime('%H:%M:%S')
#This is the insert line
tapped = "INSERT INTO log (rfid, taptime) VALUES (%s, %s)" %(a, now)
t = conn.cursor()
t.execute(tapped)
conn.commit()
Traceback (most recent call last):
File "door.py", line 54, in <module>
t.execute(tapped)
File "/usr/local/lib/python2.7/dist-packages/pymysql/cursors.py", line 170, in execute
result = self._query(query)
File "/usr/local/lib/python2.7/dist-packages/pymysql/cursors.py", line 328, in _query
conn.query(q)
File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 517, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 732, in _read_query_result
result.read()
File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 1075, in read
first_packet = self.connection._read_packet()
File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 684, in _read_packet
packet.check_error()
File "/usr/local/lib/python2.7/dist-packages/pymysql/protocol.py", line 220, in check_error
err.raise_mysql_exception(self._data)
File "/usr/local/lib/python2.7/dist-packages/pymysql/err.py", line 109, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.ProgrammingError: (1064, u"You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ':40:44)' at line 1")
Я просто хочу получить доступ к лог-базе данных карт.