module doesn't provide __init__ in 1.2.3c1

2010-04-26
2012-09-19
  • Steve Endres
    Steve Endres
    2010-04-26

    After what looked like a successful build and install on Mac OSx. Snow Leopard
    I get the following error. Any ideas why?

    import MySQLdb

    Traceback (most recent call last):

    File "<stdin>", line 1, in <module>

    File "build/bdist.macosx-10.6-universal/egg/MySQLdb/init.py", line 19, in
    <module>

    File "build/bdist.macosx-10.6-universal/egg/_mysql.py", line 7, in <module>

    File "build/bdist.macosx-10.6-universal/egg/_mysql.py", line 6, in
    bootstrap

    ImportError: dynamic module does not define init function (init_mysql)

     
  • Steve Endres
    Steve Endres
    2010-04-26

    Found this post on http://www.davidcramer.net/code/57/mysqldb-on-
    leopard.html
    and
    removing the directories below fixed my import problem:

    Begin of post by user muanis

    I've got the same problem.

    Running mysql 5.1.35. After discovering that I should change to 32 bit
    version, repeated all the steps and got the same error about the init
    function.

    import MySQLdb

    import sys, pkg_resources, imp

    Traceback (most recent call last):

    File "", line 1, in

    File "MySQLdb/init.py", line 19, in

    import _mysql

    File "build/bdist.macosx-10.5-i386/egg/_mysql.py", line 7, in

    File "build/bdist.macosx-10.5-i386/egg/_mysql.py", line 6, in bootstrap

    ImportError: dynamic module does not define init function (init_mysql)

    After a couple of hours debugging I noticed that the dist and build dirs of
    MySQLdb 1.2.2 were not removed when I issue a python setup.py clean.

    I manually removed both of them and got everything working fine.