[Python-modules-team] Bug#896396: python-django-tables2: django_tables2 fails to import

Helmut Grohne helmut at subdivi.de
Fri Apr 20 21:00:48 BST 2018


Package: python-django-tables2
Version: 1.14.2-1
Severity: serious
User: helmutg at debian.org
Usertags: python-import

After installing python-django-tables2 importing the module django_tables2
into a python interpreter fails with the following error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/django_tables2/__init__.py", line 2, in <module>
    from .tables import Table, TableBase
  File "/usr/lib/python2.7/dist-packages/django_tables2/tables.py", line 15, in <module>
    from . import columns
  File "/usr/lib/python2.7/dist-packages/django_tables2/columns/__init__.py", line 8, in <module>
    from .jsoncolumn import JSONColumn
  File "/usr/lib/python2.7/dist-packages/django_tables2/columns/jsoncolumn.py", line 15, in <module>
    from django.contrib.postgres.fields import HStoreField, JSONField
  File "/usr/lib/python2.7/dist-packages/django/contrib/postgres/fields/__init__.py", line 1, in <module>
    from .array import *  # NOQA
  File "/usr/lib/python2.7/dist-packages/django/contrib/postgres/fields/array.py", line 3, in <module>
    from django.contrib.postgres import lookups
  File "/usr/lib/python2.7/dist-packages/django/contrib/postgres/lookups.py", line 4, in <module>
    from .search import SearchVector, SearchVectorExact, SearchVectorField
  File "/usr/lib/python2.7/dist-packages/django/contrib/postgres/search.py", line 47, in <module>
    class SearchVector(SearchVectorCombinable, Func):
  File "/usr/lib/python2.7/dist-packages/django/contrib/postgres/search.py", line 50, in SearchVector
    _output_field = SearchVectorField()
  File "/usr/lib/python2.7/dist-packages/django/db/models/fields/__init__.py", line 172, in __init__
    self.db_tablespace = db_tablespace or settings.DEFAULT_INDEX_TABLESPACE
  File "/usr/lib/python2.7/dist-packages/django/conf/__init__.py", line 56, in __getattr__
    self._setup(name)
  File "/usr/lib/python2.7/dist-packages/django/conf/__init__.py", line 39, in _setup
    % (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

The vast majority of import failures is attributed to missing dependencies.
Often times that manifests as an ImportError or ModuleNotFoundError.
Typically, dependencies should be inserted by dh-python via ${python:Depends}
or ${python3:Depends}. Thus a missing dependency can be caused by incomplete
install_requires in setup.py. Sometimes a missing dependency of a dependency
is the cause, in such cases this bug should be reassigned.

Helmut



More information about the Python-modules-team mailing list