I’ve decided to go with MySQL for my latest product for a variety of reasons.
To build MySQL support for Python, you have to have the MySQL headers and such available.
Even though I installed from the MySQL supported binary for OS X 10.6, the MySQL-python installer couldn’t find the support files.
To get it to work, I had to edit `site.cfg` in the `MySQL-python-1.2.3c1` directory to uncomment out line 13 and edit it to read:
mysql_config = /usr/local/mysql/bin/mysql_config
The comment in the code says, above that:
# The path to mysql_config. # Only use this if mysql_config is not on your PATH, or you have some weird # setup that requires it.
Well, isn’t that special…
Then, to add insult to stupidity:
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/backends/mysql/base.py", line 13, in
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e) django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dynamic module does not define init function (init_mysql)
I found some instructions that suggested trashing the build directory, then executing the following (I broke it into separate lines):
# export ARCHFLAGS="-arch x86_64" # python setup.py build # sudo python setup.py install
This, however, gave me the same error on import.
So, I trashed `build`, `dist`, and `*.egg-info` and tried again.
So, I dug a little deeper. Of course, there’s always the suggestion that one build MySQL from source, but that just seems melodramatic.
It’s not complaining about MySQL, it’s complaining about the module not defining an init function.
I hunted down this thread that seems to be right up to yesterday so obviously I’m not the only one arguing with this:
So far, the solutions all seem to say to run Python in 32 bit mode but that just seems idiotic. I’ve got 64 bit everything and this library just doesn’t seem to have correct build instructions. I’m not going to start crippling my system in the hopes of making it limp along; that’s just stupid.
Of course, it’s after 1am and so am I right now so I think I’ll stop…for now.