--> -->
IntegrityError | Python 3.8.10: /usr/bin/python3 Sun May 25 17:23:35 2025 |
A problem occurred in a Python script. Here is the sequence of
function calls leading up to the error, in the order they occurred.
/home/eturk09/public_html/formdatainserter.cgi in <module> |
14 #create a new record in the database
|
15 sql = "INSERT INTO `numbers` (`num`, `word`) VALUES (%s, %s)"
|
=> 16 cursor.execute(sql, (num, word))
|
17 # connection is not autocommit by default. So you must commit to save your changes.
|
18 connection.commit()
|
cursor = <pymysql.cursors.DictCursor object>, cursor.execute = <bound method Cursor.execute of <pymysql.cursors.DictCursor object>>, sql = 'INSERT INTO `numbers` (`num`, `word`) VALUES (%s, %s)', num = None, word = None |
/usr/local/lib/python3.8/dist-packages/pymysql/cursors.py in execute(self=<pymysql.cursors.DictCursor object>, query='INSERT INTO `numbers` (`num`, `word`) VALUES (NULL, NULL)', args=(None, None)) |
146 query = self.mogrify(query, args)
|
147
|
=> 148 result = self._query(query)
|
149 self._executed = query
|
150 return result
|
result undefined, self = <pymysql.cursors.DictCursor object>, self._query = <bound method Cursor._query of <pymysql.cursors.DictCursor object>>, query = 'INSERT INTO `numbers` (`num`, `word`) VALUES (NULL, NULL)' |
/usr/local/lib/python3.8/dist-packages/pymysql/cursors.py in _query(self=<pymysql.cursors.DictCursor object>, q='INSERT INTO `numbers` (`num`, `word`) VALUES (NULL, NULL)') |
308 self._last_executed = q
|
309 self._clear_result()
|
=> 310 conn.query(q)
|
311 self._do_get_result()
|
312 return self.rowcount
|
conn = <pymysql.connections.Connection object>, conn.query = <bound method Connection.query of <pymysql.connections.Connection object>>, q = 'INSERT INTO `numbers` (`num`, `word`) VALUES (NULL, NULL)' |
/usr/local/lib/python3.8/dist-packages/pymysql/connections.py in query(self=<pymysql.connections.Connection object>, sql=b'INSERT INTO `numbers` (`num`, `word`) VALUES (NULL, NULL)', unbuffered=False) |
546 sql = sql.encode(self.encoding, "surrogateescape")
|
547 self._execute_command(COMMAND.COM_QUERY, sql)
|
=> 548 self._affected_rows = self._read_query_result(unbuffered=unbuffered)
|
549 return self._affected_rows
|
550
|
self = <pymysql.connections.Connection object>, self._affected_rows = 0, self._read_query_result = <bound method Connection._read_query_result of <pymysql.connections.Connection object>>, unbuffered = False |
/usr/local/lib/python3.8/dist-packages/pymysql/connections.py in _read_query_result(self=<pymysql.connections.Connection object>, unbuffered=False) |
773 else:
|
774 result = MySQLResult(self)
|
=> 775 result.read()
|
776 self._result = result
|
777 if result.server_status is not None:
|
result = <pymysql.connections.MySQLResult object>, result.read = <bound method MySQLResult.read of <pymysql.connections.MySQLResult object>> |
/usr/local/lib/python3.8/dist-packages/pymysql/connections.py in read(self=<pymysql.connections.MySQLResult object>) |
1154 def read(self):
|
1155 try:
|
=> 1156 first_packet = self.connection._read_packet()
|
1157
|
1158 if first_packet.is_ok_packet():
|
first_packet undefined, self = <pymysql.connections.MySQLResult object>, self.connection = None, self.connection._read_packet undefined |
/usr/local/lib/python3.8/dist-packages/pymysql/connections.py in _read_packet(self=<pymysql.connections.Connection object>, packet_type=<class 'pymysql.protocol.MysqlPacket'>) |
723 if self._result is not None and self._result.unbuffered_active is True:
|
724 self._result.unbuffered_active = False
|
=> 725 packet.raise_for_error()
|
726 return packet
|
727
|
packet = <pymysql.protocol.MysqlPacket object>, packet.raise_for_error = <bound method MysqlPacket.raise_for_error of <pymysql.protocol.MysqlPacket object>> |
/usr/local/lib/python3.8/dist-packages/pymysql/protocol.py in raise_for_error(self=<pymysql.protocol.MysqlPacket object>) |
219 if DEBUG:
|
220 print("errno =", errno)
|
=> 221 err.raise_mysql_exception(self._data)
|
222
|
223 def dump(self):
|
global err = <module 'pymysql.err' from '/usr/local/lib/python3.8/dist-packages/pymysql/err.py'>, err.raise_mysql_exception = <function raise_mysql_exception>, self = <pymysql.protocol.MysqlPacket object>, self._data = b"\xff\x18\x04#23000Column 'num' cannot be null" |
/usr/local/lib/python3.8/dist-packages/pymysql/err.py in raise_mysql_exception(data=b"\xff\x18\x04#23000Column 'num' cannot be null") |
139 errval = data[9:].decode("utf-8", "replace")
|
140 errorclass = error_map.get(errno)
|
141 if errorclass is None:
|
142 errorclass = InternalError if errno < 1000 else OperationalError
|
=> 143 raise errorclass(errno, errval)
|
errorclass = <class 'pymysql.err.IntegrityError'>, errno = 1048, errval = "Column 'num' cannot be null" |
IntegrityError: (1048, "Column 'num' cannot be null")
args =
(1048, "Column 'num' cannot be null")
with_traceback =
<built-in method with_traceback of IntegrityError object>