Graham Dumpleton
graham.dumpleton at gmail.com
Tue Mar 18 22:08:30 EDT 2008
On 19/03/2008, syahreza octadian <syahreza.octadian at gmail.com> wrote: > Joseph Sliz wrote: > "The message I get in the server error log is as follows: > > ImportError: No module named mod_python.apache > > [Tue Mar 18 12:11:04 2008] [error] make_obcallback: Python path being > used "['C:\\\\Python24\\\\python24.zip', '.\\\\DLLs', '.\\\\lib', > '.\\\\lib\\\\plat-win', '.\\\\lib\\\\lib-tk', 'C:\\\\Program > Files\\\\Apache Software Foundation\\\\Apache2.2\\\\bin']". > > [Tue Mar 18 12:11:04 2008] [error] get_interpreter: no interpreter > callback found. > > [Tue Mar 18 12:11:04 2008] [error] [client 127.0.0.1] python_handler: > Can't get/create interpreter > " > from the error it seem your python cannot find the library. > if you try to import with console if there some error?? > > if there is error you can use this before import mod_python > > import sys > > sys.path.append('your python library sample: > "/usr/lib/python2.5/site-packages"') > import mod_python Don't go adding site-packages manually, it should never be required to be added explicitly. Using sys.path.append() on a site-packages directory is also wrong anyway as it doesn't result in .pth files in that directory working properly. As has been covered before on this list, the problem revolves around Python interpreter within mod_python module not being able to find the Python installation properly. In particular it can't find and import the site.py file which is what does all the path setup included adding site-packages. Because it doesn't do that, it will not find mod_python installation even if installed in site-packages properly. As mentioned before, that Apache running as a service means it runs as a different user, it is important that that user have correct access permissions for Python installation and mod_python files, if not, that is one reason it can fail. The next is not having installed Python, Apache and mod_python as Administrator user. Even if one uninstalls all three and reinstalls, even this may not fix things up if the directories weren't removed entirely and so files with bad permissions still exist. Also, having installed multiple versions of Python at various points can also screw things up if they haven't been removed properly. This is because bad registry entries can be left behind. Thus if reinstalling hasn't helped, you should uninstall again and then use regedit to search out for Python registry entries in both user and machine scopes and possibly remove them and then install again as Administrator. Finally, if someone has installed a third party package which contains its own version of Python and that appears in PATH before the standard one, then Python interpreter within mod_python can find it mistakenly. In some cases it looks like these custom Python interpreter instances structure things a bit differently and so why it cant find the site.py file to load. So, if you uninstalled everything and reinstalled as Administrator user and it still didn't work, then do the following: 0. Try rebooting your system in case something is cached. 1. Uninstall Python and mod_python again. 2. If C:\Python24 still exists then remove it. Make sure mod_python module has been removed from Apache directory. 3. Use a registry editor (run as Administrator) to search for Python entries. For example of what to look for see: http://www.modpython.org/pipermail/mod_python/2006-September/021980.html These may be in user or machine contexts. If they look like they are for Python you have installed previously, remove them. 4. Search your whole system for PYTHON*.DLL. If such a thing exists in some third party package, ensure that that directory for its applications is not in your user PATH or that of user that Apache runs as. 5. Reinstall Python and mod_python as Administrator user. Review what file and directory permissions things are installed as and that they aren't restrictive such that the user that Apache service runs as will not be able to access them. Also see what registry entries Python has installed and ensure they are in machine context and not a specific user context. So, please work through that and give clear feedback at each point of what you found. It is really hard when someone just keeps saying it doesn't work without giving positive feedback that they have in fact done correctly what they may have been asked to do and indicate what they found. Random suggestions from others who have not seen the particular problem before, although well meaning, just help to confuse things, so can we just try the above first. Also be aware I am not a Windows person and never use it. All the above is based purely on information previously appearing on the mailing list and which has worked at one time or another for people. Thus, I may be saying stuff which is crap. This is where it would help if Windows users could step in at appropriate time and explain properly how one does these things and where registry entries should exist and what they look like etc. Finally, be patient. This particular Windows issue is always a pain to work out and can take time. Don't expect an instant solution, often the stuff just starts working for people and they never really can say what the original problem was. Even if they do know, they usually never say what it was and so we never work out better debugging procedures. Graham
|