Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am getting ImportError: No localization support for language 'eng' when using MySQL Connector in Python. My Traceback is as below.

Traceback (most recent call last):
  File "DB_Module.py", line 151, in QueryDatabase
  File "\shareappModulesmysqlconnector\__init__.py", line 44, in Connect
  File "\shareappModulesmysqlconnectorconnection.py", line 106, in __init__
  File "\shareappModulesmysqlconnectorconnection.py", line 325, in connect
  File "\shareappModulesmysqlconnectorconnection.py", line 288, in _open_connection
  File "\shareappModulesmysqlconnector
etwork.py", line 326, in open_connection
  File "\sfsshow_timeShowtime_PackageshowtimeModulesmysqlconnectorerrors.py", line 160, in __init__
  File "\shareappModulesmysqlconnectorlocales\__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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.4k views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...