问题描述
使用MySQL Connector Python时,我得到ImportError: No localization support for language 'eng'
.我的回溯如下.
i am getting ImportError: No localization support for language 'eng'
when using MySQL Connector Python.My Traceback is as below.
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
谁能告诉我如何解决此错误.
Can anyone tell me how to fix this error.
推荐答案
为了使MySql连接器打印实际的错误字符串-它需要语言环境"目录中的eng/client_error文件.
In order for the MySql connector to print the actual error string - it needs the eng/client_error file in the "locales" dir.
我个人只是手动创建了目录"eng",然后从此链接复制粘贴文件: http://pydoc.net/Python/mysql-connector-python/1.0.7/mysql.connector.locales.eng.client_error/
I personally, just manually created the dir "eng" and copy-paste the file from this link: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.
我再次运行代码,并收到:
I run the code again, and received:
2013: Lost connection to MySQL server during query
您可能会遇到其他错误,但希望对您有所帮助.
You'll probably get a different error, but hope it helps.
这篇关于ImportError:Python中不支持语言"eng"的本地化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!