Graham Dumpleton
grahamd at dscpl.com.au
Sat Mar 5 21:44:14 EST 2005
Not strictly true. You will not be meaningfully be able to do anything because _apache which is builtin to mod_python will not be available, but one can learn various things from the errors which result when you do try and load mod_python from a command line Python. Repeating some instructions from a previous email: If mod_python has been installed, you can determine which version is being used by executing "python" itself and attempting to import the module "mod_python.psp". For example: ~ [510]$ python Python 2.3 (#1, Sep 13 2003, 00:49:11) [GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import mod_python.psp If you see a Python exception of the form: ImportError: No module named _apache it means that you have mod_python version 3.1. If you see the Python exception: ImportError: No module named psp it means that you only have version 2.7. Finally, if you instead see the Python exception: ImportError: No module named mod_python.psp it means that mod_python isn't installed after all, or at least not for the version of Python you are trying to use. On 06/03/2005, at 1:33 PM, John Raines wrote: > I would say this much more briefly: you can only import mod_python > from code running under apache; python won't find mod_python > otherwise. > On Mar 5, 2005, at 6:43 PM, Graham Dumpleton wrote: > >> >> On 06/03/2005, at 9:10 AM, bruce wrote: >> >>> graham... >>> >>> i did post this issue/question to the modpython group... although i >>> haven't >>> posted there for a guru... >> >> And on the mod_python mailing list you were asked some questions and >> given some things to try. You didn't however give an answer to the >> questions. We can't read minds. :-) >> >>> but in answer to the rest of your questions.... >>> >>> here's what i'm doing... >>> >>> python >>> pyhton 2.3.3 ...... >>> type help... >>>>>> import mod_python.psp >>> . >>> . >>> . >>> ImportError: No module named mod_python >> >> Getting this error in itself is strange, as trying to import a >> submodule >> of a module that does not exist, would usually yield: >> >> ImportError: No module named mod_python.psp >> >> if the parent module does not exist. >> >> Either way, it simply doesn't look like mod_python is installed for >> that >> version of Python. Does saying: >> >> import mod_python >> >> fail as well. What error does it give in that situation? >> >> You can verify manually whether it has been installed by finding the >> "site-packages" >> directory for the Python installation and looking in there for a >> mod_python >> directory. >> >> Note that there are two parts to the installation of mod_python, >> there is the >> Apache handler .so which gets installed in Apache modules directory >> and the >> Python code modules which get installed in "site-packages". So far it >> seems >> it is the latter that does not exist. >> >> Anyway, if you don't know where to look for the "site-packages" >> directory, run >> in Python: >> >> import sys >> print sys.prefix >> >> This should tell you where Python stuff is being installed. For >> Python 2.3, the >> site-packages directory would be in a subdirectory of that directory >> called: >> >> lib/python2.3/site-packages >> >> Thus change to directory specified by sys.prefix and then run: >> >> ls lib/python2.3/site-packages/mod_python >> >> Does that say the directory doesn't exist? If it doesn't exist, then >> your installation >> isn't complete. If it does exist, what is in that directory? >> >> I also ask again the same question as posed in the original mailing >> list response to >> you, do you possibly have more than one version of Python installed >> on your system? >> >>> i'm doing the above from the linux command line >>> >>> >>> i have >>> RH8.0 >>> python-2.3.3-6 >>> mod_python-3.1.3-5 >>> apache/2.0.50 (built from source) >>> >>> >>> so, any ideas!!! >>> >>> thanks... >>> >>> bruce >>> >>> >>> -----Original Message----- >>> From: python-list-bounces+bedouglas=earthlink.net at python.org >>> [mailto:python-list-bounces+bedouglas=earthlink.net at python.org]On >>> Behalf >>> Of grahamd at dscpl.com.au >>> Sent: Saturday, March 05, 2005 1:56 PM >>> To: python-list at python.org >>> Subject: Re: python/linux guru needed.. now!!!! >>> >>> >>> >>> bruce wrote: >>>> hi... >>>> >>>> i have a situation with a linux rh8 server. i can't seem to get >>>> python/mod_python/apache working as one... >>>> >>>> i can't seem to import mod_python from the python interpreter to >>> work, and >>>> i'm not sure as to why. i'm fairly convinced that it's a conflict >>> issue of >>>> some type, but i'm not sure as to how to resolve it... >>>> >>>> if you are a guru with python/mod_python/linux then i'd like to talk >>> with >>>> you... >>>> >>>> searching through google/mailing lists/etc... is getting me >>>> nowhere!! >>> >>> You will do better if you present your problem in the mod_python >>> mailing >>> list. Go to http://www.modpython.org to get the mailing list details, >>> get >>> yourself on the list and then post the following information as a >>> start. >>> >>> Which version of mod_python you are using. >>> >>> Whether you are using the global configuration file or a .htaccess >>> file. >>> >>> The snippet of the Apache configuration you are using to configure >>> mod_python and enable its use in the directory you are working in. >>> >>> Details of any error responses which are being displayed by your web >>> browser. >>> >>> Details of messages, be they notices or error messages, which occur >>> in >>> the Apache error log file corresponding to any request you are making >>> which is not working. >>> >>> The full contents of the Python code file for the content handler you >>> are >>> trying to use. >>> >>> -- >>> http://mail.python.org/mailman/listinfo/python-list >> >> _______________________________________________ >> Mod_python mailing list >> Mod_python at modpython.org >> http://mailman.modpython.org/mailman/listinfo/mod_python >> > > _______________________________________________ > Mod_python mailing list > Mod_python at modpython.org > http://mailman.modpython.org/mailman/listinfo/mod_python
|