django installation breaks modules command in python help()

Bug #128761 reported by Ralph Janke
10
Affects Status Importance Assigned to Milestone
Django
Fix Released
Unknown
python-django (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

Binary package hint: python-django

After installation of python-django, the modules command inside help() ends with the following error message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site.py", line 351, in __call__
    return pydoc.help(*args, **kwds)
  File "/usr/lib/python2.5/pydoc.py", line 1649, in __call__
    self.interact()
  File "/usr/lib/python2.5/pydoc.py", line 1667, in interact
    self.help(request)
  File "/usr/lib/python2.5/pydoc.py", line 1683, in help
    elif request == 'modules': self.listmodules()
  File "/usr/lib/python2.5/pydoc.py", line 1804, in listmodules
    ModuleScanner().run(callback)
  File "/usr/lib/python2.5/pydoc.py", line 1855, in run
    for importer, modname, ispkg in pkgutil.walk_packages():
  File "/usr/lib/python2.5/pkgutil.py", line 125, in walk_packages
    for item in walk_packages(path, name+'.', onerror):
  File "/usr/lib/python2.5/pkgutil.py", line 125, in walk_packages
    for item in walk_packages(path, name+'.', onerror):
  File "/usr/lib/python2.5/pkgutil.py", line 110, in walk_packages
    __import__(name)
  File "/var/lib/python-support/python2.5/django/core/cache/__init__.py", line 54, in <module>
    cache = get_cache(settings.CACHE_BACKEND)
  File "/var/lib/python-support/python2.5/django/conf/__init__.py", line 28, in __getattr__
    self._import_settings()
  File "/var/lib/python-support/python2.5/django/conf/__init__.py", line 53, in _import_settings
    raise EnvironmentError, "Environment variable %s is undefined." % ENVIRONMENT_VARIABLE
EnvironmentError: Environment variable DJANGO_SETTINGS_MODULE is undefined.

Revision history for this message
William Grant (wgrant) wrote :

You need to run Django stuff from within an appropriately configured Django environment, or at least with that environment variable set.

Changed in python-django:
status: New → Invalid
Revision history for this message
Ralph Janke (txwikinger) wrote :

Well, I respectfully disagree.

Why do I have to set the Django environment if I just use python without django? And if so, it should be configured to be set automatically. Currently, installing django breaks python.

Revision history for this message
Ralph Janke (txwikinger) wrote :

Could you please reconsider your decision setting this report to invalid.

While your statement makes sense in regards to running django. The problem is that as soon as django is installed, python itself is broken. There is no need to set a django environment variable for the situations in which python is used simultaneously for other purposes than django.

If it is not possible to remove this error entirely, and the only option is that the environment variable is set, then the installation of django should configure the system in such a way that the variable is set automatically and also points to a default configuration file.

I think it is overreaching to accept that existence of django breaks the usage of the help system in python in general only because django is not setup.

I appreciate your help and consideration.

Changed in python-django:
status: Invalid → New
Revision history for this message
Carl Karsten (carlfk) wrote :

It is a problem, and here is a fix: http://code.djangoproject.com/changeset/6832

btw, for those that want to repo this:
>>> help()
Welcome to Python 2.5! This is the online help utility.
....
help> modules
Please wait a moment while I gather a list of all available modules...

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
...

Revision history for this message
Andrea Gasparini (gaspa) wrote :

Carl, Ralph, I don't have the fix installed, but the bug doesn't appear...

Could you please tell the versions in wich the bug appears, and give some informations about your system?
(at least in which ubuntu version...)

I tried all versions from 0.95-1 (the feisty one)

Changed in python-django:
status: New → Incomplete
Revision history for this message
Neal McBurnett (nealmcb) wrote :

This is pretty clear-cut, I think.

I can confirm this on feisty, with python-django version 0.95.1-1ubuntu1
and on gutsy with 0.96-1ubuntu0.1

Changed in python-django:
status: Incomplete → Confirmed
Changed in django:
status: Unknown → Fix Released
Revision history for this message
Ralph Janke (txwikinger) wrote :

Can confirm that this fix has been released latest with version 1.0-1ubuntu1 in intrepid.

Changed in python-django:
importance: Undecided → Low
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.