3

Can someone please tell what this strange error 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
1
  • What does your mod_python config look like? Are you modifying PYTHONPATH? Commented Aug 19, 2010 at 13:14

1 Answer 1

1

That you're missing the Cookie package (which is not part of Django), but it should be Builtin.

If you're using Python 3 please note that Cookie has been renamed to http.cookies, and that Django is incompatible with Python not 2.x.

That is what you're missing: http://docs.python.org/library/cookie.html.

Edit

I see you're running python 2.4. Consider switch to python 2.6 or 2.7, and check the presence of /usr/lib/python2.4/Cookie.py

Solution

The path was missing, so adding

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

solves the issue.

Sign up to request clarification or add additional context in comments.

3 Comments

The file /usr/lib/python2.4/Cookie.py is present
Maybe django is overwriting for some reason your python path. What about doing something like sys.path.append('/usr/lib/python2.4/') in your settings.py or urls.py? Or in your cgi provider. I know it's a stupid try, but no other ideas...
It was sys.path, that was missing in the python path..thanks for the lead

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.