ImportError: No localization support for language

2020-04-11 07:47发布

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'

And my Current used SQL is

SELECT * FROM systemdetails 
WHERE System_ID = 'System1' LIMIT 1

Can anyone tell me how to fix this error.

1条回答
一纸荒年 Trace。
2楼-- · 2020-04-11 08:09

In order for the MySql connector to print the actual error string - it needs the eng/client_error file in the "locales" dir.

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.

查看更多
登录 后发表回答