Requested Module was not found: No module named 'mysql.connector.plugins.caching_sha2_password'

163 Views Asked by At

I have converted my test.py file to test.exe file using pyinstaller :pyinstaller --onefile --hidden-import mysql.connector.plugins.caching_sha2_password test.py but this it gives me the following error :

    Requested Module was not found: No module named 'mysql.connector.plugins.caching_sha2_password'
Traceback (most recent call last):
  File "test.py", line 8, in <module>
    new_records = execute_query("SELECT * FROM queue WHERE state='pend'")
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "database.py", line 5, in execute_query
    connection = mysql.connector.connect(
                 ^^^^^^^^^^^^^^^^^^^^^^^^
  File "mysql\connector\pooling.py", line 294, in connect
  File "mysql\connector\connection.py", line 167, in __init__
  File "mysql\connector\connection.py", line 622, in close
  File "mysql\connector\connection.py", line 1132, in cmd_quit
  File "mysql\connector\network.py", line 172, in send_plain
  File "mysql\connector\errors.py", line 54, in __init__
  File "mysql\connector\locales\__init__.py", line 62, in get_client_error
ImportError: No localization support for language 'eng'
[10468] Failed to execute script 'test' due to unhandled exception!

Can you help me to solve this problem

1

There are 1 best solutions below

0
NekoDarkZ On

I'm also creating a .exe application using Pyinstaller. I was able to solve that error with the following import:

from mysql.connector.locales.eng import client_error

But now I have this new error:

Authentication plugin 'caching_sha2_password' is not supported. Requested Module was not found: No module named 'mysql.connector.plugins.caching_sha2_password'

I hope to find the solution to this new error. I've tried uninstalling mysql-connector and mysql-connector-python libraries, but nothing seems to work.

I trust this information proves useful.