Menu

ImproperlyConfigured: Error loading MySQLdb m

Help
jmatter
2008-04-19
2012-09-19
  • jmatter

    jmatter - 2008-04-19

    I have been able to get mysqldb working through python
    I'm pulling my hair out trying to get it working on my osx 10.4 box
    with apache/mod_python/mysqldb

    I have confirmed that apache works, mod_python works, and mysqldb work
    stand alone.

    I was following the django book and created the time example and was
    able to browse to it through the development server at http://127.0.0.1:8000/time/.
    I then try to go to it through apache at http://127.0.0.1/mysite/time/
    and I get these errors and I feel like I have tried everything
    (rebuilding mysqldb etc....with a modified _mysql.c without etc) I
    keep getting:

    ImproperlyConfigured: Error loading MySQLdb module: bad local file
    header in /Library/Frameworks/Python.framework/Versions/2.5/lib/
    python2.5/site-packages/MySQL_python-1.2.2-py2.5-macosx-10.3-fat.egg

    Any help would be much appreciated.

    Here is the full error:

    MOD_PYTHON ERROR

    ProcessId: 1439
    Interpreter: 'www.myserver.dev'

    ServerName: 'www.myserver.dev'
    DocumentRoot: '/Library/WebServer/Documents'

    URI: '/mysite/time/'
    Location: '/mysite/'
    Directory: None
    Filename: '/Library/WebServer/Documents/mysite'
    PathInfo: '/time/'

    Phase: 'PythonHandler'
    Handler: 'django.core.handlers.modpython'

    Traceback (most recent call last):

    File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
    python2.5/site-packages/mod_python/importer.py", line 1537, in
    HandlerDispatch
    default=default_handler, arg=req, silent=hlist.silent)

    File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
    python2.5/site-packages/mod_python/importer.py", line 1229, in
    _process_target
    result = _execute_target(config, req, object, arg)

    File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
    python2.5/site-packages/mod_python/importer.py", line 1128, in
    _execute_target
    result = object(arg)

    File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
    python2.5/site-packages/django/core/handlers/modpython.py", line 189,
    in handler
    return ModPythonHandler()(req)

    File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
    python2.5/site-packages/django/core/handlers/modpython.py", line 162,
    in call
    response = self.get_response(request)

    File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
    python2.5/site-packages/django/core/handlers/base.py", line 64, in
    get_response
    response = middleware_method(request)

    File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
    python2.5/site-packages/django/contrib/sessions/middleware.py", line
    13, in process_request
    engine = import(settings.SESSION_ENGINE, {}, {}, [''])

    File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
    python2.5/site-packages/django/contrib/sessions/backends/db.py", line
    2, in <module>
    from django.contrib.sessions.models import Session

    File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
    python2.5/site-packages/django/contrib/sessions/models.py", line 5, in
    <module>
    from django.db import models

    File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
    python2.5/site-packages/django/db/init.py", line 17, in <module>
    backend = import('%s%s.base' % (_import_path,
    settings.DATABASE_ENGINE), {}, {}, [''])

    File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
    python2.5/site-packages/django/db/backends/mysql/base.py", line 12, in
    <module>
    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)

    ImproperlyConfigured: Error loading MySQLdb module: bad local file
    header in /Library/Frameworks/Python.framework/Versions/2.5/lib/
    python2.5/site-packages/MySQL_python-1.2.2-py2.5-macosx-10.3-fat.egg

     
    • jmatter

      jmatter - 2008-04-20

      This was probably because I didn't read enough at:

      http://www.djangoproject.com/documentation/modpython/

      Following the instructions for:

      Using eggs with mod_python

      sorted out the issue. I had to add the PythonInterpreter and the PythonImport directives and set them to my site.

       

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.