django-filter v2.0 python syntax error

Created on 23 Jul 2018  路  2Comments  路  Source: carltongibson/django-filter

I just Upgraded django-filter from 1.1 to 2.0 version for my django(1.11.6 version) projects. But when i used pip install requirements.txt file (pip install -r requirements.txt), it's shown error like that:

Traceback (most recent call last): File "/home/tuananhbien/anaconda3/envs/ducnhom/lib/python2.7/site-packages/django/utils/autoreload.py", line 228, in wrapper fn(*args, **kwargs) File "/home/tuananhbien/anaconda3/envs/ducnhom/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run self.check(display_num_errors=True) File "/home/tuananhbien/anaconda3/envs/ducnhom/lib/python2.7/site-packages/django/core/management/base.py", line 359, in check include_deployment_checks=include_deployment_checks, File "/home/tuananhbien/anaconda3/envs/ducnhom/lib/python2.7/site-packages/django/core/management/base.py", line 346, in _run_checks return checks.run_checks(**kwargs) File "/home/tuananhbien/anaconda3/envs/ducnhom/lib/python2.7/site-packages/django/core/checks/registry.py", line 81, in run_checks new_errors = check(app_configs=app_configs) File "/home/tuananhbien/anaconda3/envs/ducnhom/lib/python2.7/site-packages/django/core/checks/urls.py", line 16, in check_url_config return check_resolver(resolver) File "/home/tuananhbien/anaconda3/envs/ducnhom/lib/python2.7/site-packages/django/core/checks/urls.py", line 26, in check_resolver return check_method() File "/home/tuananhbien/anaconda3/envs/ducnhom/lib/python2.7/site-packages/django/urls/resolvers.py", line 254, in check for pattern in self.url_patterns: File "/home/tuananhbien/anaconda3/envs/ducnhom/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/home/tuananhbien/anaconda3/envs/ducnhom/lib/python2.7/site-packages/django/urls/resolvers.py", line 405, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/home/tuananhbien/anaconda3/envs/ducnhom/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/home/tuananhbien/anaconda3/envs/ducnhom/lib/python2.7/site-packages/django/urls/resolvers.py", line 398, in urlconf_module return import_module(self.urlconf_name) File "/home/tuananhbien/anaconda3/envs/ducnhom/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "/home/tuananhbien/ducnhom/services/sbox4net/urls.py", line 21, in <module> from agents.monitor.views import SecurityEventsListView, SecurityEventsDetailsView, NetworkSecurityAlertDetailsView, \ File "/home/tuananhbien/ducnhom/services/agents/monitor/views.py", line 14, in <module> from django_filters.rest_framework import DjangoFilterBackend File "/home/tuananhbien/anaconda3/envs/ducnhom/lib/python2.7/site-packages/django_filters/__init__.py", line 4, in <module> from .filterset import FilterSet File "/home/tuananhbien/anaconda3/envs/ducnhom/lib/python2.7/site-packages/django_filters/filterset.py", line 184 def __init__(self, data=None, queryset=None, *, request=None, prefix=None): ^ SyntaxError: invalid syntax
From python traceback error, i think django-filter has python syntax error:
https://github.com/carltongibson/django-filter/blob/91b6dd49bed885432f9590ab8396382790015879/django_filters/filterset.py#L184

My environement:
Django==1.11.6
python=2.7

Most helpful comment

Hi @TuanAnhBien. The 2.0 release isn't compatible with Python 2. You should add django-filter~=1.1 to your requirements or pin to an exact version.

953 should ensure that Python 2 users are not able to install the 2.x line.

All 2 comments

Hi @TuanAnhBien. The 2.0 release isn't compatible with Python 2. You should add django-filter~=1.1 to your requirements or pin to an exact version.

953 should ensure that Python 2 users are not able to install the 2.x line.

Thanks @rpkilby . As your advice, I fixed my issues by downgrade from django-filter v2.0 to v1.1 and it worked like charm :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lalzada picture lalzada  路  3Comments

nhuzaa picture nhuzaa  路  3Comments

GuillaumeCisco picture GuillaumeCisco  路  3Comments

edmorley picture edmorley  路  3Comments

loganknecht picture loganknecht  路  4Comments