Django mod-python error

Can someone tell me what a strange mistake this is

 Mod_python error: "PythonHandler django.core.handlers.modpython"

 Traceback (most recent call last):

 File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 287, in HandlerDispatch
log=debug)

 File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 464, in import_module
  module = imp.load_module(mname, f, p, d)

 File "/project/django/django/core/handlers/modpython.py", line 4, in ?
  from django import http

File "/project/django/django/http/__init__.py", line 3, in ?
 from Cookie import SimpleCookie, CookieError

 ImportError: No module named Cookie


 Edit:
  Python   
 Python 2.4.3 (#1, Jan 14 2008, 18:32:40) 
 [GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> from Cookie import SimpleCookie, CookieError
  >>> from http.Cookie import SimpleCookie, CookieError
  Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  ImportError: No module named http.Cookie
 >>> import Cookie
 >>> import http.Cookie
 Traceback (most recent call last):
  File "<stdin>", line 1, in ?
 ImportError: No module named http.Cookie
 >>> import http.Cookie
+2
source share
1 answer

That you are missing the cookie package (which is not part of Django), but it needs to be built in.

If you are using Python 3, please note that it has Cookiebeen renamed to http.cookies, and that Django is not compatible with Python 2.x.

This is what you are missing :. http://docs.python.org/library/cookie.html

Edit

I see that you are running python 2.4. Consider upgrading to python 2.6 or 2.7 and check for availability/usr/lib/python2.4/Cookie.py

Decision

There was no path, so adding

sys.path.append('/usr/lib/python2.4/')

solves the problem.

0
source

All Articles