如何跟踪导致此mysql异常的字符串?

时间:2017-02-15 11:42:52

标签: python mysql python-2.7 utf-8

我已经开始使用一些软件解决一些问题,我之前从未使用过mysql,并且在运行与mysql交互的一个python脚本时出现错误。

这是Traceback:

Assign scans to examsets
Traceback (most recent call last):
  File "analyse.py", line 16, in <module>
    scans.AssignScansToExamSets()
  File "/home/connor/billing/billing/scans.py", line 1190, in AssignScansToExamSets
    scanTable = scanTable, examSetsTable = examSetsTable)
  File "/home/connor/billing/billing/funcautoassign.py", line 234, in AutoAssignScansToExamSets
    debug = examSetsTable.Flush(log, startTime)
  File "/home/connor/billing/billing/scandb.py", line 1175, in Flush
    examSetIds = self.db.multiple_insert("examset", vals)
  File "/usr/local/lib/python2.7/dist-packages/web.py-0.37-py2.7.egg/web/db.py", line 840, in multiple_insert
    self._db_execute(db_cursor, q1)
  File "/usr/local/lib/python2.7/dist-packages/web.py-0.37-py2.7.egg/web/db.py", line 587, in _db_execute
    out = cur.execute(query, params)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 176, in execute
    if not self._defer_warnings: self._warning_check()
  File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 92, in _warning_check
    warn(w[-1], self.Warning, 3)
_mysql_exceptions.Warning: Invalid utf8 character string: 'A1421C'

如何找到该字符串的位置?有关解决此问题的任何建议吗? mysql数据库目前正在使用latin1作为charset,据我所知,utf8的东西应该没问题。如何设置mysql数据库导入特定的字符集?

0 个答案:

没有答案