Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No more python_2_unicode_compatible on django 3.0 #138

Open
jyr opened this issue Dec 11, 2019 · 1 comment
Open

No more python_2_unicode_compatible on django 3.0 #138

jyr opened this issue Dec 11, 2019 · 1 comment

Comments

@jyr
Copy link

jyr commented Dec 11, 2019

Hi

I trying to build an app with django + django-dynamic-scraper and I have the error:

api_1  | Watching for file changes with StatReloader
api_1  | Exception in thread django-main-thread:
api_1  | Traceback (most recent call last):
api_1  |   File "/usr/local/lib/python3.7/threading.py", line 926, in _bootstrap_inner
api_1  |     self.run()
api_1  |   File "/usr/local/lib/python3.7/threading.py", line 870, in run
api_1  |     self._target(*self._args, **self._kwargs)
api_1  |   File "/usr/local/lib/python3.7/site-packages/django/utils/autoreload.py", line 53, in wrapper
api_1  |     fn(*args, **kwargs)
api_1  |   File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
api_1  |     autoreload.raise_last_exception()
api_1  |   File "/usr/local/lib/python3.7/site-packages/django/utils/autoreload.py", line 76, in raise_last_exception
api_1  |     raise _exception[1]
api_1  |   File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 357, in execute
api_1  |     autoreload.check_errors(django.setup)()
api_1  |   File "/usr/local/lib/python3.7/site-packages/django/utils/autoreload.py", line 53, in wrapper
api_1  |     fn(*args, **kwargs)
api_1  |   File "/usr/local/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
api_1  |     apps.populate(settings.INSTALLED_APPS)
api_1  |   File "/usr/local/lib/python3.7/site-packages/django/apps/registry.py", line 114, in populate
api_1  |     app_config.import_models()
api_1  |   File "/usr/local/lib/python3.7/site-packages/django/apps/config.py", line 211, in import_models
api_1  |     self.models_module = import_module(models_module_name)
api_1  |   File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
api_1  |     return _bootstrap._gcd_import(name[level:], package, level)
api_1  |   File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
api_1  |   File "<frozen importlib._bootstrap>", line 983, in _find_and_load
api_1  |   File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
api_1  |   File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
api_1  |   File "<frozen importlib._bootstrap_external>", line 728, in exec_module
api_1  |   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
api_1  |   File "/usr/local/lib/python3.7/site-packages/dynamic_scraper/models.py", line 3, in <module>
api_1  |     from django.utils.encoding import python_2_unicode_compatible
api_1  | ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding' (/usr/local/lib/python3.7/site-packages/django/utils/encoding.py)

After an investigación I found it 'Removed private Python 2 compatibility APIs'

😭

@mpkasp
Copy link

mpkasp commented Jul 19, 2021

Looks like it can be fixed by replacing the django.utils.encoding import with importing six.

When trying to makemigrations I then get a bunch of errors of models not setting on_delete too. Seems like this package doesn't support Django 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants