It was because SELinux was enabled. Thanks, Graham! You saved me! On Nov 29, 4:24 pm, Graham Dumpleton <[email protected]> wrote: > See: > > http://www.crypt.gen.nz/selinux/disable_selinux.html > > Graham > > 2009/11/30 Hang-A <[email protected]>: > > > > > On Nov 29, 3:51 pm, Graham Dumpleton <[email protected]> > > wrote: > >> 2009/11/30 Hang-A <[email protected]>: > > >> > I am usingmod_wsgiin embedded mode. > >> > And #3 is my current configuration option. > >> > My application code starts as follows: > > >> > import os, sys > >> > os.environ['PYTHON_EGG_CACHE'] = '/egg_cache' > >> > abspath = os.path.dirname(__file__) > >> > sys.path.append(abspath) > >> > os.chdir(abspath) > > >> Provide output from: > > >> ls -las /egg_cache > > >> so can confirm ownership of directory and contents. > > > The output is as follows: > > total 16 > > 8 drwxr-xr-x 2 apache root 4096 Nov 29 15:56 . > > 8 drwxr-xr-x 26 root root 4096 Nov 29 15:36 .. > > >> Ensure that there is no residual stuff in directory from previously > >> with different ownership. > > >> > import webapp,simplejson > >> > ... > > >> > I will continue to using the embedded mode. > >> > How different are your #1 and #2? > > >> Only #1 is usable in embedded mode. It has same effect as setting in > >> WSGI script, although since done in Apache configuration will > >> automatically be applied to all WSGI applications running in embedded > >> mode and not just that singe one. > > >> The #2 option is equivalent to #1 if using daemon mode. > > >> Only other thing that can think of that will cause an issue on RedHat > >> is ifSELinuxextension enabled. > > > I've noticed that SELinux is enabled. > > Since I am not familiar with this, I'm studying it. > > > Thanks for your comments. > > >> Graham > > >> > By the way, Clodoaldo, after reinstalling simplejson with > >> > easy_install, > >> > now I am getting the following error: > >> > mod_wsgi (pid=2955): Target WSGI script '/var/www/wsgi-bin/dtm_app/ > >> > dtm_test_app.wsgi' cannot be loaded as Python module. > >> > [Sun Nov 29 15:38:11 2009] [error] [client 127.0.0.1] mod_wsgi > >> > (pid=2955): Exception occurred processing WSGI script '/var/www/wsgi- > >> > bin/dtm_app/dtm_test_app.wsgi'. > >> > [Sun Nov 29 15:38:11 2009] [error] [client 127.0.0.1] Traceback (most > >> > recent call last): > >> > [Sun Nov 29 15:38:11 2009] [error] [client 127.0.0.1] File "/var/www/ > >> > wsgi-bin/dtm_app/dtm_test_app.wsgi", line 10, in ? > >> > [Sun Nov 29 15:38:11 2009] [error] [client 127.0.0.1] import > >> > webapp, simplejson > >> > [Sun Nov 29 15:38:11 2009] [error] [client 127.0.0.1] ImportError: No > >> > module named simplejson > > >> > Any solutions? > > >> > Thanks! > > >> > On Nov 29, 3:05 pm, Graham Dumpleton <[email protected]> > >> > wrote: > >> >> How are you configuring the location of the Python EGG cache. Are you > >> >> using: > > >> >> 1. WSGIPythonEggs directive? Which means you MUST be using embedded > >> >> mode. > > >> >> 2. Setting python-eggs option to WSGIDaemonProcess? Which means you > >> >> MUST be using daemon mode and application must be properly delegated > >> >> to that daemon mode process. > > >> >> 3. Setting PYTHON_EGG_CACHE in os.environ in WSGI script file? > > >> >> 4. Some other way? > > >> >> You need to provide more information about your configuration. Right > >> >> now, you aren't using the correct way of setting Python egg cache for > >> >> how you are running your application. > > >> >> Graham > > >> >> 2009/11/29 Hang-A <[email protected]>: > > >> >> > Hi, list! > > >> >> > I am installing a wsgi application on Red Hat Linux. > >> >> > My current configuration is apach 2.2 + mod_wsgi 3.0 + python 2.4. > >> >> > My problem is that egg cache environmental variable does not work, > >> >> > even though I think I set it up right. > >> >> > The following is error message I'm getting: > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] mod_wsgi > >> >> > (pid=3416): Target WSGI script '/var/www/wsgi-bin/dtm_app/ > >> >> > dtm_test_app.wsgi' cannot be loaded as Python module. > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] mod_wsgi > >> >> > (pid=3416): Exception occurred processing WSGI script '/var/www/wsgi- > >> >> > bin/dtm_app/dtm_test_app.wsgi'. > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] Traceback (most > >> >> > recent call last): > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] File > >> >> > "/var/www/ > >> >> > wsgi-bin/dtm_app/dtm_test_app.wsgi", line 10, in ? > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] import > >> >> > webapp, simplejson > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] File "build/ > >> >> > bdist.linux-i686/egg/simplejson/__init__.py", line 108, in ? > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] File "build/ > >> >> > bdist.linux-i686/egg/simplejson/decoder.py", line 7, in ? > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] File "build/ > >> >> > bdist.linux-i686/egg/simplejson/scanner.py", line 5, in ? > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] File "build/ > >> >> > bdist.linux-i686/egg/simplejson/_speedups.py", line 7, in ? > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] File "build/ > >> >> > bdist.linux-i686/egg/simplejson/_speedups.py", line 4, in > >> >> > __bootstrap__ > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] File > >> >> > "/usr/lib/ > >> >> > python2.4/site-packages/setuptools-0.6c11-py2.4.egg/pkg_resources.py", > >> >> > line 881, in resource_filename > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] return > >> >> > get_provider(package_or_requirement).get_resource_filename( > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] File > >> >> > "/usr/lib/ > >> >> > python2.4/site-packages/setuptools-0.6c11-py2.4.egg/pkg_resources.py", > >> >> > line 1351, in get_resource_filename > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] > >> >> > self._extract_resource(manager, self._eager_to_zip(name)) > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] File > >> >> > "/usr/lib/ > >> >> > python2.4/site-packages/setuptools-0.6c11-py2.4.egg/pkg_resources.py", > >> >> > line 1372, in _extract_resource > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] real_path = > >> >> > manager.get_cache_path( > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] File > >> >> > "/usr/lib/ > >> >> > python2.4/site-packages/setuptools-0.6c11-py2.4.egg/pkg_resources.py", > >> >> > line 962, in get_cache_path > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] > >> >> > self.extraction_error() > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] File > >> >> > "/usr/lib/ > >> >> > python2.4/site-packages/setuptools-0.6c11-py2.4.egg/pkg_resources.py", > >> >> > line 928, in extraction_error > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] raise err > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] ExtractionError: > >> >> > Can't extract file(s) to egg cache > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] The following > >> >> > error occurred while trying to extract file(s) to the Python egg > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] cache: > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] [Errno 17] > >> >> > File exists: '/egg_cache' > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] The Python egg > >> >> > cache directory is currently set to: > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] /egg_cache/ > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] Perhaps your > >> >> > account does not have write access to this directory? You can > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] change the cache > >> >> > directory by setting the PYTHON_EGG_CACHE environment > >> >> > [Sun Nov 29 04:07:04 2009] [error] [client 127.0.0.1] variable to > >> >> > point to an accessible directory. > > >> >> > One thing that is different from typical errors is that Error no is > >> >> > not 13 but 17, > >> >> > which I cannot make sense of. > >> >> > The directory /egg_cache is owned by apache (user account that Apache > >> >> > runs as) so that it can write in that directory. > >> >> > With the same application I had no problem in Mac Leopard, but I now > >> >> > have in Red Hat linux. > >> >> > Any comments are welcome. Thanks in advance. > > >> >> > from Myunghwa Hwang > > >> >> > -- > > >> >> > You received this message because you are subscribed to the Google > >> >> > Groups "modwsgi" group. > >> >> > To post to this group, send email to [email protected]. > >> >> > To unsubscribe from this group, send email to > >> >> > [email protected]. > >> >> > For more options, visit this group > >> >> > athttp://groups.google.com/group/modwsgi?hl=en. > > >> > -- > > >> > You received this message because you are subscribed to the Google > >> > Groups "modwsgi" group. > >> > To post to this group, send email to [email protected]. > >> > To unsubscribe from this group, send email to > >> > [email protected]. > >> > For more options, visit this group > >> > athttp://groups.google.com/group/modwsgi?hl=en. > > > -- > > > You received this message because you are subscribed to the Google Groups > > "modwsgi" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group > > athttp://groups.google.com/group/modwsgi?hl=en.
-- You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
