ImportError: No module named __future__

5,780 views
Skip to first unread message

David Martin

unread,
Aug 9, 2006, 7:04:11 AM8/9/06
to Django developers
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
457, in import_module
module = imp.load_module(mname, f, p, d)

File "/home/django/django/core/handlers/modpython.py", line 1, in ?
from django.core.handlers.base import BaseHandler

File "/home/django/django/core/handlers/base.py", line 2, in ?
from django.dispatch import dispatcher

File "/home/django/django/dispatch/dispatcher.py", line 28, in ?
from __future__ import generators

ImportError: No module named __future__


I've setup Django before without major problems, but I'm setting it up
on another personal server, and for some reason this time I get this
error message. when the httpd.conf -> PythonPath has sys.path
included, it can only be included by putting it in the single quotes as
such 'sys.path', When I add it as sys.path + it tells me it
can't find the django module. Any ideas?

Malcolm Tredinnick

unread,
Aug 9, 2006, 7:32:34 AM8/9/06
to django-d...@googlegroups.com
On Wed, 2006-08-09 at 04:04 -0700, David Martin wrote:
[...]

> ImportError: No module named __future__
>
>
> I've setup Django before without major problems, but I'm setting it up
> on another personal server, and for some reason this time I get this
> error message. when the httpd.conf -> PythonPath has sys.path
> included, it can only be included by putting it in the single quotes as
> such 'sys.path', When I add it as sys.path + it tells me it
> can't find the django module. Any ideas?

This definitely suggests you don't have the standard Python paths in
your environment (__future__.py is a real file and is going to be
in /usr/lib/python2.4/ in your case -- you might want to check it really
exists, I guess, just to be sure).

Sounds like you need to work with your mod_python PythonPath line a bit
more. For quick reference, one of my setups looks like this:

PythonPath "['/home/malcolm/code'] + sys.path"

and I have /usr/lib/python2.3/site-packages/django symlinked to the
django directory in my Django source tree. You should be able to put as
many extra paths as you like in the [...] portion of that statement, so
you don't need your Django code anywhere near your Python site-packages/
directory if you don't want to.

Cheers,
Malcolm


Reply all
Reply to author
Forward
0 new messages