On Jul 29, 5:28 pm, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > On Jul 30, 2:37 am, 7stud <[EMAIL PROTECTED]> wrote: > > > > > On Jul 29, 4:07 am, Graham Dumpleton <[EMAIL PROTECTED]> > > wrote: > > > > Have you got an appropriate LoadModule directive in Apache > > > configuration to load the mod_python module? That you get this error > > > is indicative of mod_python module not being loaded. You can check the > > > Apache error logs to see if mod_python got loaded. > > > > See: > > > > http://www.dscpl.com.au/wiki/ModPython/Articles/GettingModPythonWorking > > > > for more help on debugging. > > > That article says the LoadModule directive should be: > > > >LoadModule python_module libexec/mod_python.so > > > I saw this note in /Library/Apache2/conf/http.conf > > > # Configuration and logfile names: If the filenames you specify for > > many > > # of the server's control files begin with "/" (or "drive:/" for > > Win32), the > > # server will use that explicit path. If the filenames do *not* begin > > # with "/", the value of ServerRoot is prepended -- so "logs/foo.log" > > # with ServerRoot set to "/Library/Apache2" will be interpreted by the > > # server as "/Library/Apache2/logs/foo.log". > > > I have this server root in /Library/Apache2/conf/httpd.conf: > > > ServerRoot "/Library/Apache2" > > > So in the Load Module directive, the actual path to the mod_python.so > > file is: > > > /Library/Apache2/libexec/mod_python.so > > > But I checked and I don't have a /Library/Apache2/libexec directory. > > Run 'apxs' for the version of Apache you are using to work out what > the actual modules directory should be: > > $ /usr/local/apache-2.2.4/bin/apxs -q LIBEXECDIR > /usr/local/apache-2.2.4/modules > > If there is no mod_python.so in there then you can't have done the > mod_python install properly. Go back to the mod_python source code and > rerun: > > sudo make install_dso > > When you do that it will even tell you exactly what the LoadModule > line you should use is. > > Also ensure you actually installed the Python module components of > mod_python. You can redo that by running: > > sudo make install_py_lib > > Graham
I posted *everything* I did to install mod_python in my second post. I just discovered there are additional steps I should have done, i.e. make and make install. After I did those steps, I looked at the output and there were no obvious errors. I then proceeded with the Testing section of the mod_python manual. I added the following LoadModule directive to my httpd.conf file: LoadModule python_module /Library/Apache2/modules/mod_python.so and I added the following to http.conf(I created the directory ../ htdocs/modPythonPages): <Directory /Library/Apache/htdocs/modPythonPages> AddHandler mod_python .py PythonHandler mptest PythonDebug On </Directory> Then I started apache and it started up normally. Then I created a file called mptest.py in the ../htdocs/modPythonPages/ directory with this in it: from mod_python import apache def handler(req): req.content_type = "text/plain" req.write("Hello World!") return apache.OK But when I type the following url in my browser's address bar: http://localhost/modPythonPages/mptest.py all the text in the file is displayed--not the message "Hello World!". So I checked the Troubleshooting section, which said to add the following to httpd.conf: <Location /mpinfo> SetHandler mod_python PythonHandler mod_python.testhandler </Location> I did that, then restarted apache, and typed the following into my browser's address bar: http://localhost/mpinfo and I got a page displaying lots of information about my configuration, but I don't know how any of that helps me figure out what is wrong. I also get this with an interactive python session: >>> import mod_python.psp Traceback (most recent call last): File "<stdin>", line 1, in ? File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/mod_python/psp.py", line 21, in ? import apache, Session, util, _psp File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/mod_python/apache.py", line 30, in ? import _apache ImportError: No module named _apache >>> import mod_python.testhandler Traceback (most recent call last): File "<stdin>", line 1, in ? File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/mod_python/testhandler.py", line 26, in ? from mod_python import apache, util File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/mod_python/apache.py", line 30, in ? import _apache ImportError: No module named _apache >>> import mod_python >>> mod_python.version '3.3.1' >>> According to your article here: http://www.dscpl.com.au/wiki/ModPython/Articles/GettingModPythonWorking that output is as it should be. Following your article, I tried using a .htaccess file instead of putting the <Directory> tags in httpd.conf. I deleted the <Directory> tags I added to httpd.conf and restarted apache, but the same thing happened when I tried to display the page in my browser: the text in the file displayed instead of the message. So following along with your article, I added the following to httpd.conf: <Directory /Library/Apache2/htdocs/modPythonPages> AllowOverride FileInfo </Directory> I restarted apache, but I got the same results when I tried to access the page in my browser. BUT THEN...I somehow happened to do an: $ls -al on my modPythonPages directory and I got this: drwxr-xr-x 5 autie admin 170 Jul 29 23:24 . drwxrwxr-x 11 root admin 374 Jul 28 15:05 .. -rw-r--r-- 1 me admin 65 Jul 29 23:18 .htaccess.txt -rw-r--r-- 1 me admin 355 Jul 29 23:24 mptest.py As you can see when I saved the file, my mac added the .txt extension. Since my mac hides the files with a "." in front of them, I couldn't what the .htaccess file looked like in Finder after I saved the file--the file just disappeared. I can't find a way to make my mac display the "." files in Finder. So, I changed the name of the file: $mv .htacces.txt .htaccess and then I typed the following in my browser's address bar again: http://localhost/modPythonPages/mptest.py and this time I got the correct message: mptest.py Yeah! So is my install good? Why didn't the Directory tags in httpd.conf work? -- http://mail.python.org/mailman/listinfo/python-list