Legacy Zope dynamic loading error with MySQL
Question: I am in the process of moving an old installation of Zope 2 to a new Mac OS
10.8 Server. Unfortunately, our server requires Python 2.4 to run, so I have
installed the MacPorts version. The server loads fine until it tries to load
the MySQL-python module, at which point it dies with an `ImportError`:

    
    
    Traceback (most recent call last):
      File "/home/zope/envLRC/Zope.2.8.6/lib/python/Zope2/Startup/run.py", line 56, in ?
        run()
      File "/home/zope/envLRC/Zope.2.8.6/lib/python/Zope2/Startup/run.py", line 21, in run
        starter.prepare()
      File "/home/zope/envLRC/Zope.2.8.6/lib/python/Zope2/Startup/__init__.py", line 98, in prepare
        self.startZope()
      File "/home/zope/envLRC/Zope.2.8.6/lib/python/Zope2/Startup/__init__.py", line 257, in startZope
        Zope2.startup()
      File "/home/zope/envLRC/Zope.2.8.6/lib/python/Zope2/__init__.py", line 47, in startup
        _startup()
      File "/home/zope/envLRC/Zope.2.8.6/lib/python/Zope2/App/startup.py", line 45, in startup
        OFS.Application.import_products()
      File "/home/zope/envLRC/Zope.2.8.6/lib/python/OFS/Application.py", line 675, in import_products
        import_product(product_dir, product_name, raise_exc=debug_mode)
      File "/home/zope/envLRC/Zope.2.8.6/lib/python/OFS/Application.py", line 698, in import_product
        product=__import__(pname, global_dict, global_dict, silly)
      File "/home/zope/envLRC/Zope.2.8.6/lib/python/Products/ZMySQLDA/__init__.py", line 91, in ?
        import DA
      File "/home/zope/envLRC/Zope.2.8.6/lib/python/Products/ZMySQLDA/DA.py", line 92, in ?
        from db import DB
      File "/home/zope/envLRC/Zope.2.8.6/lib/python/Products/ZMySQLDA/db.py", line 89, in ?
        import _mysql
      File "build/bdist.macosx-10.8-x86_64/egg/_mysql.py", line 7, in ?
      File "build/bdist.macosx-10.8-x86_64/egg/_mysql.py", line 6, in __bootstrap__
    ImportError: Inappropriate file type for dynamic loading
    

The server is running in a virtualenv to ensure that Python 2.4 is used. Can
anyone explain to me why this error is generated and what should be done about
it? Thanks!


Answer: It looks like something installed/created a `_mysql.py`, you should have a
`_mysql.so`. If you have the `.so`, try to rename the `_mysql.py` file and
restart.

