MySQL Workbench的Data Import Wizard功能是用python实现的,MySQL Workbench自带了一个python,数据导入的时候出现错误提示
22:55:51 [ERR][ pymforms]: Unhandled exception in Python code:
Traceback (most recent call last):
File "D:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\sqlide_power_import_export_be.py", line 547, in analyze_file
json_value = json.loads(col_value)
^^^^^^^^^^^^^^^^^^^^^
File "D:\Program Files\MySQL\MySQL Workbench 8.0 CE\Python\Lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Program Files\MySQL\MySQL Workbench 8.0 CE\Python\Lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Program Files\MySQL\MySQL Workbench 8.0 CE\Python\Lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Program Files\MySQL\MySQL Workbench 8.0 CE\workbench\wizard_page_widget.py", line 98, in go_next
self.main.go_next_page()
File "D:\Program Files\MySQL\MySQL Workbench 8.0 CE\workbench\wizard_form.py", line 77, in go_next_page
self.pages[index].page_activated(True)
File "D:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\sqlide_power_import_wizard.py", line 186, in page_activated
self.call_create_preview_table()
File "D:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\sqlide_power_import_wizard.py", line 344, in call_create_preview_table
self.create_preview_table(self.call_analyze())
^^^^^^^^^^^^^^^^^^^
File "D:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\sqlide_power_import_wizard.py", line 353, in call_analyze
if not self.active_module.analyze_file():
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\sqlide_power_import_export_be.py", line 552, in analyze_file
self._columns[j]['value'].append(col_value)
~~~~~~~~~~~~~^^^
IndexError: list index out of range
这其实是python的代码报错,很有可能是csv文件中出现了非法英文逗号,或者非法英文单引号。
假设你的csv是10行10列的表,但是某个单元格中出现了非法字符,以至于程序在解析csv文件的时候,发现某一行没有10个列,所以数组越界。
怎么查看日志文件,请看这篇文章MySQL Workbench 日志文件