Menu

import problems in leopard 10.5.6 python2.5

rockydev
2009-04-02
2012-09-19
  • rockydev

    rockydev - 2009-04-02

    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)
    >>>

     
    • Andy Dustman

      Andy Dustman - 2009-04-02

      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)?

       
      • rockydev

        rockydev - 2009-04-03

        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

         
        • Andy Dustman

          Andy Dustman - 2009-04-06

          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.

           

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.