This is my first pyramid application and I have tried what ever solution I could find but none are working for me. I keep getting internal server error and error logs show this :
Tue Jul 31 02:02:23 2012] [error] [client 127.0.0.1] import MySQLdb as mysql
[Tue Jul 31 02:02:23 2012] [error] [client 127.0.0.1] File "build/bdist.macosx-10.7- intel/egg/MySQLdb/__init__.py", line 19, in <module>
[Tue Jul 31 02:02:23 2012] [error] [client 127.0.0.1] File "build/bdist.macosx-10.7-intel/egg/_mysql.py", line 7, in <module>
[Tue Jul 31 02:02:23 2012] [error] [client 127.0.0.1] File "build/bdist.macosx-10.7-intel/egg/_mysql.py", line 6, in __bootstrap__
[Tue Jul 31 02:02:23 2012] [error] [client 127.0.0.1] ImportError: dlopen(/Users/anupamtulsyan/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg-tmp/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
[Tue Jul 31 02:02:23 2012] [error] [client 127.0.0.1] Referenced from: /Users/anupamtulsyan/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg-tmp/_mysql.so
[Tue Jul 31 02:02:23 2012] [error] [client 127.0.0.1] Reason: image not found
[Tue Jul 31 02:02:24 2012] [error] [client 127.0.0.1] File does not exist: /opt/local/apache2/htdocs/favicon.ico
Both my mysql and python are 64 bit installation. The file ‘libmysqlclient.18.dylib’ exists in /usr/local/mysql/lib.
I am able to import MySQLdb while serving the application using :
../bin/pserver development.ini
However when running through mod_wsgi the above error keeps coming. Please someone help ! I have been stuck on this since 2 days.
It looks like the
libmysqlclient.18.dylibis not on Apache’s path. So you probably need to set it in/usr/sbin/envvarssomething like:depending on where your mysql lib is and then restart apache.
I think you may also be able to set
DYLD_RUN_PATHbefore building MySQLdb and it will use that path in the _mysql.so — obviating the need to setDYLD_LIBRARY_PATH