Menu

init failed in _mysql when importing from mod

Maki Kato
2001-05-30
2012-09-19
  • Maki Kato

    Maki Kato - 2001-05-30

    I was trying to get 0.9.0c2 working last night on a RH7.1 box with mod_python and got an error importing _mysql through MySQLdb.  The error was init failed.  I could load the module fine from a test program running from the shell, but not from mod_python.

    Relavent info:
    RH7.1
    MySQL 3.23.36-1
    Python 2.0 without threads
    mod_python 2.7.2

    I think it might be the from exceptions import Exception, StandardError in _mysql_exceptions.py file.

    Anyone else seeing this problem?

    ....maki....

     
    • Andy Dustman

      Andy Dustman - 2001-05-30

      Almost always if the init fails on importing _mysql, it's because _mysql couldn't find _mysql_exceptions.py. This should be installed in the same place as _mysql.so. Could mod_python be playing with sys.path?

       
      • David O'Callaghan

        I was having the same problem (init failed in _mysql) while using mod_snake. It works fine now that I've downgraded to 0.3.5

        The _mysql_exceptions.py file was in the same directory (/usr/lib/python2.0/site-packages) as _mysql.so, and with sensible permissions (i.e. world readable)

        sys.path looked fine and it certainly worked OK from the interpreter.

         
        • Andy Dustman

          Andy Dustman - 2001-06-22

          Something to try as a workaround: Try importing _mysql_exceptions prior to importing MySQLdb.  This will ensure the module is actually loaded prior to importing _mysql (which imports _mysql_exceptions) during it's initialization), so it will already be in sys.modules and it will not have to search along sys.path. Normally there is no reason to do this, but perhaps something weird is happening in mod_snake.

           

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.