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

Dirk van Oosterbosch, IR labs labs at ixopusada.com
Thu Jun 7 09:43:20 EDT 2007


Hi,

I'm not sure I follow, or why all this is necessary.

First, what should be the interpreter_name you speak of? 'python'? / 
usr/local/bin/python'? sol740satelite.lan' (as is stated in the  
logs ...(pid=553, interpreter='sol740satelite.lan') ) ?

Second, this directory that nobody (the User defined in httpd.conf)  
can write to, could that just me /var/tmp ?

Thirdly. Why is this necessary? Does this PythonImport statement (and  
the module) has to stay there? Or is this just the last, obscure,  
step in the installation process?

----

BTW, in the meantime, I decided to upgrade to Python 2.5.1, because I  
thought that might fix my problems. Unfortunately, it did not. But it  
did change the error messages I got returned. ;-)
Still, after I restart my powerBook, the ExtractionError, with the  
PYTHON_EGG_CACHE setting pops up.
And then when I stop/start apache (without yet putting this module in  
place, because I don't know what to use as interpreter_name), the  
following error gets there (full log transscript below):

ImportError: dlopen(/Users/dirk/.python-eggs/MySQL_python-1.2.2-py2.5- 
macosx-10.3-fat.egg-tmp/_mysql.so, 2): image not found

I noticed while building MySQLdb, it said something about ppc / i386  
incompatibility, but since it continued building I ignored this  
warning. Shouldn't I? (Cant recall the exact message, and lost the  
information in that Terminal window after the last restart, obviously).

Also I noticed that the .py modules I use with mod_python (my web- 
app) start with #!/usr/bin/python, but there exists no python binary  
(or symlink) in /usr/bin.
% which python
/usr/local/bin/python
% ls /usr/local/bin/python
/usr/local/bin/python@ -> ../../../Library/Frameworks/ 
Python.framework/Versions/2.5/bin/python

Should I copy the /usr/local/bin/python symlink to /usr/bin/python  
aswell?


(
Finally (again), the thing to note,  is that these problems with  
importing MySQLdb only happen from within Apache/mod_python. Not from  
the interpreter.
% python
Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04)
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> import MySQLdb

I read on the forum of MySQLdb at sourceforge, that others also had  
this problem with 'ImportError: dlopen(/Users/dirk/.python-eggs/...):  
image not found'. But they seem to experience this from the  
interpreter as well.
)


dirk



On 7-jun-2007, at 13:27, Graham Dumpleton wrote:

> 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.

> 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




[Thu Jun 07 15:09:12 2007] [notice] mod_python: Creating 8 session  
mutexes based on 6 max processes and 25 max threads.
[Thu Jun 07 15:09:12 2007] [notice] mod_python: using  
mutex_directory /tmp
[Thu Jun 07 15:09:12 2007] [notice] Apache/2.0.55 (Unix) mod_python/ 
3.3.1 Python/2.5.1 configured -- resuming normal operations
[Thu Jun 07 15:09:20 2007] [notice] mod_python (pid=553,  
interpreter='sol740satelite.lan'): Importing module '/Users/dirk/ 
Sites/www/python/translate.py'
[Thu Jun 07 15:09:20 2007] [notice] mod_python (pid=553,  
interpreter='sol740satelite.lan'): Importing module '/Users/dirk/ 
Sites/www/python/LocalConf.py'
[Thu Jun 07 15:09:20 2007] [error] [client ::1] mod_python (pid=553,  
interpreter='sol740satelite.lan', phase='PythonTransHandler',  
handler='translate'): Application error
[Thu Jun 07 15:09:20 2007] [error] [client ::1] ServerName:  
'sol740satelite.lan'
[Thu Jun 07 15:09:20 2007] [error] [client ::1] DocumentRoot: '/Users/ 
dirk/Sites/www'
[Thu Jun 07 15:09:20 2007] [error] [client ::1] URI: '/'
[Thu Jun 07 15:09:20 2007] [error] [client ::1] Location: None
[Thu Jun 07 15:09:20 2007] [error] [client ::1] Directory: None
[Thu Jun 07 15:09:20 2007] [error] [client ::1] Filename: None
[Thu Jun 07 15:09:20 2007] [error] [client ::1] PathInfo: None
[Thu Jun 07 15:09:20 2007] [error] [client ::1] Traceback (most  
recent call last):
[Thu Jun 07 15:09:20 2007] [error] [client ::1]   File "/Library/ 
Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/ 
mod_python/importer.py", line 1537, in HandlerDispatch\n     
default=default_handler, arg=req, silent=hlist.silent)
[Thu Jun 07 15:09:20 2007] [error] [client ::1]   File "/Library/ 
Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/ 
mod_python/importer.py", line 1202, in _process_target\n    module =  
import_module(module_name, path=path)
[Thu Jun 07 15:09:20 2007] [error] [client ::1]   File "/Library/ 
Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/ 
mod_python/importer.py", line 296, in import_module\n    log,  
import_path)
[Thu Jun 07 15:09:20 2007] [error] [client ::1]   File "/Library/ 
Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/ 
mod_python/importer.py", line 680, in import_module\n    execfile 
(file, module.__dict__)
[Thu Jun 07 15:09:20 2007] [error] [client ::1]   File "/Users/dirk/ 
Sites/www/python/translate.py", line 31, in <module>\n    from  
LocalConf import log_file, path_wwwroot
[Thu Jun 07 15:09:20 2007] [error] [client ::1]   File "/Library/ 
Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/ 
mod_python/importer.py", line 991, in load_module\n    return  
_global_modules_cache.import_module(self.__file)
[Thu Jun 07 15:09:20 2007] [error] [client ::1]   File "/Library/ 
Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/ 
mod_python/importer.py", line 680, in import_module\n    execfile 
(file, module.__dict__)
[Thu Jun 07 15:09:20 2007] [error] [client ::1]   File "/Users/dirk/ 
Sites/www/python/LocalConf.py", line 22, in <module>\n    import  
MySQLdb # FIXME
[Thu Jun 07 15:09:20 2007] [error] [client ::1]   File "build/ 
bdist.macosx-10.3-fat/egg/MySQLdb/__init__.py", line 19, in <module>
[Thu Jun 07 15:09:20 2007] [error] [client ::1]   File "build/ 
bdist.macosx-10.3-fat/egg/_mysql.py", line 7, in <module>
[Thu Jun 07 15:09:20 2007] [error] [client ::1]   File "build/ 
bdist.macosx-10.3-fat/egg/_mysql.py", line 6, in __bootstrap__
[Thu Jun 07 15:09:20 2007] [error] [client ::1] ImportError: dlopen(/ 
Users/dirk/.python-eggs/MySQL_python-1.2.2-py2.5-macosx-10.3-fat.egg- 
tmp/_mysql.so, 2): image not found



-----------------------------
Dirk van Oosterbosch
de Wittenstraat 225
1052 AT Amsterdam
the Netherlands

http://labs.ixopusada.com
-----------------------------


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20070607/aef68601/attachment-0001.html


More information about the Mod_python mailing list