SoFunction
Updated on 2024-11-16

python mysqldb connect to database

No way to down a 2.6, if you use 2.4 is too low, and tossed, half a day to find the MySQL-python-1.2.2.win32-py2. This installation file, the installation is complete, the implementation of import MySQLdb appeared in the problem prompt:
File "C:\Python26\lib\site-packages\MySQLdb\__init__.py", line 19, in <module>
ImportError: DLL load failed: The specified module could not be found.
After countless searches, found that the official statement is also also not very correct, the official solution given is LD_LIBRARY_PATH load such an environment variable, loaded the same can not solve the problem, more ways to refer to linux under the processing, the
I searched for countless information and found out that there are 2 missing dll files which are , search for them and download them from many places, then copy them to WINDOWS\system32 and execute them now and they appear again.
Got the error, this thing is amazing, the error message is:
sys:1: DeprecationWarning: the sets module is deprecated
This error, and I looked for countless information, read a lot of things, and finally found that the 2.6 version is no longer recommended to use sets this module, but in order to compatibility still loaded this module but did a warning message, I think a lot of
After many unsuccessful attempts to prevent warnings or catch exceptions, we took the worst possible approach, modifying the original file by going into the python installation directory and finding the following file Python26\Lib\ commented out lines 83-85
#import warnings
#("the sets module is deprecated", DeprecationWarning,stacklevel=2)
It'll work, I gave it a merge into 2 lines above.
By now mysqldb installation is complete, there is no longer any error output, and understand, why the official did not release 2.6 version of mysqldb.
This version of python3k should already have support for the sets module, so the official release from the beginning, there has been no real version, that is to say, now python3k can not use mysqldb this space to connect mysql . And a lot of work
It seems that to realize the popularity of 3k there is still a lot of road to go, and then people who want to learn python at this stage will have to keep choosing to spend time with the torture.

My gui hadn't even started and it took all day.