使用MySQL Connector Python时我得到ImportError: No localization support for language 'eng'
。
我的追溯如下。
Traceback (most recent call last):
File \"DB_Module.py\", line 151, in QueryDatabase
File \"\\share\app\Modules\mysql\connector\__init__.py\", line 44, in Connect
File \"\\share\app\Modules\mysql\connector\connection.py\", line 106, in __init__
File \"\\share\app\Modules\mysql\connector\connection.py\", line 325, in connect
File \"\\share\app\Modules\mysql\connector\connection.py\", line 288, in _open_connection
File \"\\share\app\Modules\mysql\connector\network.py\", line 326, in open_connection
File \"\\sfs\show_time\Showtime_Package\showtime\Modules\mysql\connector\errors.py\", line 160, in __init__
File \"\\share\app\Modules\mysql\connector\locales\__init__.py\", line 52, in get_client_error
ImportError: No localization support for language 'eng'
我当前使用的SQL是
SELECT * FROM systemdetails
WHERE System_ID = 'System1' LIMIT 1
任何人都可以告诉我如何修复此错误。
答案 0 :(得分:1)
为了让MySql连接器打印实际的错误字符串 - 它需要" locales"中的eng / client_error文件。 DIR。
我个人而言,只是手动创建了目录" eng"并从此链接复制粘贴文件: http://pydoc.net/Python/mysql-connector-python/1.0.7/mysql.connector.locales.eng.client_error/
> mkdir eng
> touch eng/__init__.py
> vi eng/client_error.py
> ... copy-paste, save, and exit.
我再次运行代码,并收到:
2013: Lost connection to MySQL server during query
你可能会得到一个不同的错误,但希望它有所帮助。