[mod_python] Breaking things after upgrading MySQLdb (to 1.2.2)

Graham Dumpleton graham.dumpleton at gmail.com
Thu Jun 7 07:27:43 EDT 2007


On 07/06/07, Dirk van Oosterbosch, IR labs <labs at ixopusada.com> wrote:
>
> Thanks,
>
> but I still won't know what would have caused this.
> I'm not running PHP (& never installed modules for it)
> I don't have any other Apache modules that I know of that could be using
> MySQLdb.
>
> After I restarted my machine, it first gave:
>
> [Thu Jun 07 10:05:54 2007] [error] [client ::1] ExtractionError: Can't
> extract file(s) to egg cache\n\nThe following error occurred while trying to
> extract file(s) to the Python egg\ncache:\n\n  [Errno 13] Permission denied:
> '/var/empty/.python-eggs'\n\nThe Python egg cache directory
> is currently set to:\n\n
> /var/empty/.python-eggs\n\nPerhaps your account does not
> have write access to this directory?  You can\nchange the cache directory by
> setting the PYTHON_EGG_CACHE environment\nvariable to point to an accessible
> directory.\n

To get rid of this problem, create a new Python code module somewhere
containing:

  import os
  os.environ['PYTHON_EGG_CACHE'] = '/some/path'

The directory /some/path must be writable to the user that Apache runs as.

Then add to Apache global configuration:

  PythonImport interpreter_name module_name

Where interpreter_name is the name of the interpreter your mod_python
application is running in, found by query req.interpreter in a request
handler. And module_name is the name of the module you created above.
If that module not in standard place, if using mod_python 3.3, use
absolute path to code file instead.

> (the full log details follow below)
>
> Then I stop & started Apache, and the error was (again):
>
> [Thu Jun 07 10:06:14 2007] [error] [client ::1] ImportError: Inappropriate
> file type for dynamic loading
>
> So I decided that maybe MySQLdb 1.2.2 is too new for me, and I installed
> MySQLdb 1.2.1_p2
> However, I am afraid that MySQLdb 1.2.2. is still there:
> Python 2.4.1 (#2, Mar 31 2005, 00:05:10)
> [GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import MySQLdb
> >>> MySQLdb.version_info
> (1, 2, 2, 'final', 0)
>
> How could I revert safely to MySQLdb 1.2.1_p2 ?
> Or what would I need to rebuild to get things working again? Apache? python?

Work out where it is installed using:

  MySQLdb.__file__

then explicitly remove it and start over.

If it is one of these horrible Python eggs, you may have to fiddle
with the eggs .pth file in site-packages to remove the reference to
it.

Graham

>
>
> On 7-jun-2007, at 1:31, Graham Dumpleton wrote:
>
>
> These sorts of issues on upgrades are usually cause by modules in PHP,
>
> other Apache modules or Python MySQLdb client libraries having been
>
> compiled against different versions of MySQLdb shared libraries.
>
>
>
>
> You need to ensure you rebuild all such packages which use MySQLdb so
>
> they all use the same version.
>
>
>
>
> Graham
>
>
> after restart
>
> [Thu Jun 07 10:05:54 2007] [notice] mod_python (pid=224,
> interpreter='sol740satelite.lan'): Importing module
> '/Users/dirk/Sites/www/python/translate.py'
> [Thu Jun 07 10:05:54 2007] [notice] mod_python (pid=224,
> interpreter='sol740satelite.lan'): Importing module
> '/Users/dirk/Sites/www/python/LocalConf.py'
> [Thu Jun 07 10:05:54 2007] [error] [client ::1] mod_python (pid=224,
> interpreter='sol740satelite.lan', phase='PythonTransHandler',
> handler='translate'): Application error
> [Thu Jun 07 10:05:54 2007] [error] [client ::1] ServerName:
> 'sol740satelite.lan'
> [Thu Jun 07 10:05:54 2007] [error] [client ::1] DocumentRoot:
> '/Users/dirk/Sites/www'
> [Thu Jun 07 10:05:54 2007] [error] [client ::1] URI: '/admin/'
> [Thu Jun 07 10:05:54 2007] [error] [client ::1] Location: None
> [Thu Jun 07 10:05:54 2007] [error] [client ::1] Directory: None
> [Thu Jun 07 10:05:54 2007] [error] [client ::1] Filename: None
> [Thu Jun 07 10:05:54 2007] [error] [client ::1] PathInfo: None
> [Thu Jun 07 10:05:54 2007] [error] [client ::1] Traceback (most recent call
> last):
> [Thu Jun 07 10:05:54 2007] [error] [client ::1]   File
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/mod_python/importer.py",
> line 1537, in HandlerDispatch\n    default=default_handler, arg=req,
> silent=hlist.silent)
> [Thu Jun 07 10:05:54 2007] [error] [client ::1]   File
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/mod_python/importer.py",
> line 1202, in _process_target\n    module = import_module(module_name,
> path=path)
> [Thu Jun 07 10:05:54 2007] [error] [client ::1]   File
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/mod_python/importer.py",
> line 296, in import_module\n    log, import_path)
> [Thu Jun 07 10:05:54 2007] [error] [client ::1]   File
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/mod_python/importer.py",
> line 680, in import_module\n    execfile(file, module.__dict__)
> [Thu Jun 07 10:05:54 2007] [error] [client ::1]   File
> "/Users/dirk/Sites/www/python/translate.py", line 30, in
> ?\n    import LocalConf
> [Thu Jun 07 10:05:54 2007] [error] [client ::1]   File
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/mod_python/importer.py",
> line 991, in load_module\n    return
> _global_modules_cache.import_module(self.__file)
> [Thu Jun 07 10:05:54 2007] [error] [client ::1]   File
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/mod_python/importer.py",
> line 680, in import_module\n    execfile(file, module.__dict__)
> [Thu Jun 07 10:05:54 2007] [error] [client ::1]   File
> "/Users/dirk/Sites/www/python/LocalConf.py", line 22, in
> ?\n    import MySQLdb
> [Thu Jun 07 10:05:54 2007] [error] [client ::1]   File
> "build/bdist.darwin-8.9.0-Power_Macintosh/egg/MySQLdb/__init__.py",
> line 19, in ?
> [Thu Jun 07 10:05:54 2007] [error] [client ::1]   File
> "build/bdist.darwin-8.9.0-Power_Macintosh/egg/_mysql.py",
> line 7, in ?
> [Thu Jun 07 10:05:54 2007] [error] [client ::1]   File
> "build/bdist.darwin-8.9.0-Power_Macintosh/egg/_mysql.py",
> line 4, in __bootstrap__
> [Thu Jun 07 10:05:54 2007] [error] [client ::1]   File
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/pkg_resources.py",
> line 799, in resource_filename\n    return
> get_provider(package_or_requirement).get_resource_filename(
> [Thu Jun 07 10:05:54 2007] [error] [client ::1]   File
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/pkg_resources.py",
> line 1228, in get_resource_filename\n    self._extract_resource(manager,
> self._eager_to_zip(name))
> [Thu Jun 07 10:05:54 2007] [error] [client ::1]   File
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/pkg_resources.py",
> line 1249, in _extract_resource\n    real_path = manager.get_cache_path(
> [Thu Jun 07 10:05:54 2007] [error] [client ::1]   File
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/pkg_resources.py",
> line 880, in get_cache_path\n    self.extraction_error()
> [Thu Jun 07 10:05:54 2007] [error] [client ::1]   File
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/pkg_resources.py",
> line 846, in extraction_error\n    raise err
> [Thu Jun 07 10:05:54 2007] [error] [client ::1] ExtractionError: Can't
> extract file(s) to egg cache\n\nThe following error occurred while trying to
> extract file(s) to the Python egg\ncache:\n\n  [Errno 13] Permission denied:
> '/var/empty/.python-eggs'\n\nThe Python egg cache directory
> is currently set to:\n\n
> /var/empty/.python-eggs\n\nPerhaps your account does not
> have write access to this directory?  You can\nchange the cache directory by
> setting the PYTHON_EGG_CACHE environment\nvariable to point to an accessible
> directory.\n
>
> after apache stop & start
>
> [Thu Jun 07 10:06:08 2007] [notice] mod_python: Creating 8 session mutexes
> based on 6 max processes and 25 max threads.
> [Thu Jun 07 10:06:08 2007] [notice] mod_python: using mutex_directory /tmp
> [Thu Jun 07 10:06:08 2007] [notice] Apache/2.0.55 (Unix) mod_python/3.3.0b
> Python/2.4.1 configured -- resuming normal operations
> [Thu Jun 07 10:06:14 2007] [notice] mod_python (pid=504,
> interpreter='sol740satelite.lan'): Importing module
> '/Users/dirk/Sites/www/python/translate.py'
> [Thu Jun 07 10:06:14 2007] [notice] mod_python (pid=504,
> interpreter='sol740satelite.lan'): Importing module
> '/Users/dirk/Sites/www/python/LocalConf.py'
> [Thu Jun 07 10:06:14 2007] [error] [client ::1] mod_python (pid=504,
> interpreter='sol740satelite.lan', phase='PythonTransHandler',
> handler='translate'): Application error
> [Thu Jun 07 10:06:14 2007] [error] [client ::1] ServerName:
> 'sol740satelite.lan'
> [Thu Jun 07 10:06:14 2007] [error] [client ::1] DocumentRoot:
> '/Users/dirk/Sites/www'
> [Thu Jun 07 10:06:14 2007] [error] [client ::1] URI: '/admin/'
> [Thu Jun 07 10:06:14 2007] [error] [client ::1] Location: None
> [Thu Jun 07 10:06:14 2007] [error] [client ::1] Directory: None
> [Thu Jun 07 10:06:14 2007] [error] [client ::1] Filename: None
> [Thu Jun 07 10:06:14 2007] [error] [client ::1] PathInfo: None
> [Thu Jun 07 10:06:14 2007] [error] [client ::1] Traceback (most recent call
> last):
> [Thu Jun 07 10:06:14 2007] [error] [client ::1]   File
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/mod_python/importer.py",
> line 1537, in HandlerDispatch\n    default=default_handler, arg=req,
> silent=hlist.silent)
> [Thu Jun 07 10:06:14 2007] [error] [client ::1]   File
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/mod_python/importer.py",
> line 1202, in _process_target\n    module = import_module(module_name,
> path=path)
> [Thu Jun 07 10:06:14 2007] [error] [client ::1]   File
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/mod_python/importer.py",
> line 296, in import_module\n    log, import_path)
> [Thu Jun 07 10:06:14 2007] [error] [client ::1]   File
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/mod_python/importer.py",
> line 680, in import_module\n    execfile(file, module.__dict__)
> [Thu Jun 07 10:06:14 2007] [error] [client ::1]   File
> "/Users/dirk/Sites/www/python/translate.py", line 30, in
> ?\n    import LocalConf
> [Thu Jun 07 10:06:14 2007] [error] [client ::1]   File
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/mod_python/importer.py",
> line 991, in load_module\n    return
> _global_modules_cache.import_module(self.__file)
> [Thu Jun 07 10:06:14 2007] [error] [client ::1]   File
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/mod_python/importer.py",
> line 680, in import_module\n    execfile(file, module.__dict__)
> [Thu Jun 07 10:06:14 2007] [error] [client ::1]   File
> "/Users/dirk/Sites/www/python/LocalConf.py", line 22, in
> ?\n    import MySQLdb
> [Thu Jun 07 10:06:14 2007] [error] [client ::1]   File
> "build/bdist.darwin-8.9.0-Power_Macintosh/egg/MySQLdb/__init__.py",
> line 19, in ?
> [Thu Jun 07 10:06:14 2007] [error] [client ::1]   File
> "build/bdist.darwin-8.9.0-Power_Macintosh/egg/_mysql.py",
> line 7, in ?
> [Thu Jun 07 10:06:14 2007] [error] [client ::1]   File
> "build/bdist.darwin-8.9.0-Power_Macintosh/egg/_mysql.py",
> line 6, in __bootstrap__
> [Thu Jun 07 10:06:14 2007] [error] [client ::1] ImportError: Inappropriate
> file type for dynamic loading
>
>
> -----------------------------
> Dirk van Oosterbosch
> de Wittenstraat 225
> 1052 AT Amsterdam
> the Netherlands
>
> http://labs.ixopusada.com
> -----------------------------
>
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>
>


More information about the Mod_python mailing list