The following error is displayed when importing MySQLdb in python 2.5 on OS X 10.5.6 :
$ python
Python 2.5.1 (r251:54863, Jan 13 2009, 10:26:13) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
/Library/Python/2.5/site-packages/MySQL_python-1.2.3c1-py2.5-macosx-10.5-i386.egg/_mysql.py:3: UserWarning: Module _mysql was already imported from /Library/Python/2.5/site-packages/MySQL_python-1.2.3c1-py2.5-macosx-10.5-i386.egg/_mysql.pyc, but /Users/rakeshdevineni/Downloads/Utilities/MySQL-python-1.2.3c1 is being added to sys.path
import sys, pkg_resources, imp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "MySQLdb/init.py", line 19, in <module>
import _mysql
File "build/bdist.macosx-10.5-i386/egg/_mysql.py", line 7, in <module>
File "build/bdist.macosx-10.5-i386/egg/_mysql.py", line 6, in bootstrap
ImportError: dynamic module does not define init function (init_mysql)
>>>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Have successfully built it in the past? Do you have MySQL installed? Including development files? (Not sure how it is packaged for OS X) Can you run Python from a different directory? Are there any build warnings or errors (from setup.py build or install)?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yeah i have Mysql 5.1.33 installed. Previously i built it for python 2.4 and it worked. But for python 2.5 it is giving the error while i try to import. I am trying the new rc1 build. the following warnings were given during the build process :
ld: warning in build/temp.macosx-10.5-i386-2.5/_mysql.o, file is not of required architecture
ld: warning in /usr/local/mysql/lib/libmysqlclient_r.dylib, file is not of required architecture
ld: warning in /usr/local/mysql/lib/libmygcc.a, file is not of required ld: warning in build/temp.macosx-10.5-i386-architecture
2.5/_mysql.o, file is not of required architecture
ld: warning in /usr/local/mysql/lib/libmysqlclient_r.dylib, file is not of required architecture
ld: warning in /usr/local/mysql/lib/libmygcc.a, file is not of required architecture
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you've reinstalled MySQL, make sure you are using the right version of mysql_install. You might using the one from the wrong version, or there could be other leftover files. Also both your Python installation and MySQL installation must have the same architecture support.
Also... look further back in the forums... particularly the help forum... because I'm sure there's a solution in there somewhere.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The following error is displayed when importing MySQLdb in python 2.5 on OS X 10.5.6 :
$ python
Python 2.5.1 (r251:54863, Jan 13 2009, 10:26:13)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
/Library/Python/2.5/site-packages/MySQL_python-1.2.3c1-py2.5-macosx-10.5-i386.egg/_mysql.py:3: UserWarning: Module _mysql was already imported from /Library/Python/2.5/site-packages/MySQL_python-1.2.3c1-py2.5-macosx-10.5-i386.egg/_mysql.pyc, but /Users/rakeshdevineni/Downloads/Utilities/MySQL-python-1.2.3c1 is being added to sys.path
import sys, pkg_resources, imp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "MySQLdb/init.py", line 19, in <module>
import _mysql
File "build/bdist.macosx-10.5-i386/egg/_mysql.py", line 7, in <module>
File "build/bdist.macosx-10.5-i386/egg/_mysql.py", line 6, in bootstrap
ImportError: dynamic module does not define init function (init_mysql)
>>>
Have successfully built it in the past? Do you have MySQL installed? Including development files? (Not sure how it is packaged for OS X) Can you run Python from a different directory? Are there any build warnings or errors (from setup.py build or install)?
Yeah i have Mysql 5.1.33 installed. Previously i built it for python 2.4 and it worked. But for python 2.5 it is giving the error while i try to import. I am trying the new rc1 build. the following warnings were given during the build process :
ld: warning in build/temp.macosx-10.5-i386-2.5/_mysql.o, file is not of required architecture
ld: warning in /usr/local/mysql/lib/libmysqlclient_r.dylib, file is not of required architecture
ld: warning in /usr/local/mysql/lib/libmygcc.a, file is not of required ld: warning in build/temp.macosx-10.5-i386-architecture
2.5/_mysql.o, file is not of required architecture
ld: warning in /usr/local/mysql/lib/libmysqlclient_r.dylib, file is not of required architecture
ld: warning in /usr/local/mysql/lib/libmygcc.a, file is not of required architecture
If you've reinstalled MySQL, make sure you are using the right version of mysql_install. You might using the one from the wrong version, or there could be other leftover files. Also both your Python installation and MySQL installation must have the same architecture support.
Also... look further back in the forums... particularly the help forum... because I'm sure there's a solution in there somewhere.