Closed sevenreeds closed 4 years ago
This is fixed in https://github.com/jjkester/django-auditlog/pull/227 - it's because that method has moved to six
in Django 3.
Thank you
On Mon, Dec 16, 2019, 3:50 PM Adam Fletcher notifications@github.com wrote:
This is fixed in #227 https://github.com/jjkester/django-auditlog/pull/227 - it's because that method has moved to six in Django 3.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jjkester/django-auditlog/issues/231?email_source=notifications&email_token=AAJCQJFYK7RJT5LGS7CU4FDQY7Z2XA5CNFSM4J3DYR2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHAHB3I#issuecomment-566259949, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJCQJBGJM4PCPYNOABEPZ3QY7Z2XANCNFSM4J3DYR2A .
I can't migrate either running
Django 3.0.2 django-auditlog 0.4.7
Traceback (most recent call last):
File "manage.py", line 19, in
Thank you … On Mon, Dec 16, 2019, 3:50 PM Adam Fletcher @.***> wrote: This is fixed in #227 <#227> - it's because that method has moved to six in Django 3. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#231?email_source=notifications&email_token=AAJCQJFYK7RJT5LGS7CU4FDQY7Z2XA5CNFSM4J3DYR2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHAHB3I#issuecomment-566259949>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJCQJBGJM4PCPYNOABEPZ3QY7Z2XANCNFSM4J3DYR2A .
how do you fixed this?
You can fix this by changing the import wherever you get this error,
old code: from django.utils.encoding import python_2_unicode_compatible, smart_text
Updated code:
from django.utils.encoding import smart_text
from six import python_2_unicode_compatible
Go to the mentioned path and edit it, or upgrade all libraries, it should solve the issue.
from django.utils.six import python_2_unicode_compatible
instead of
from django.utils.encoding import python_2_unicode_compatible
and let me know if this works.
@adnanrizwee thank you it worked
Django 3 support is coming, see #256 , #257
this solution fixed my issue https://stackoverflow.com/questions/20741754/python-2-unicode-compatible-error/63914949#63914949
Hi,
I am running python 3.8, django 3 and django-auditlog 0.4.5 (latest pip and PyCharm know about).
When I try to do a clean
python manage.py makemigrations ...
I get:Traceback (most recent call last): File "manage.py", line 22, in <module> execute_from_command_line(sys.argv) File "/home/me/PycharmProjects/myApp/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line utility.execute() File "/home/me/PycharmProjects/myApp/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 377, in execute django.setup() File "/home/me/PycharmProjects/myApp/venv/lib/python3.8/site-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/home/me/PycharmProjects/myApp/venv/lib/python3.8/site-packages/django/apps/registry.py", line 114, in populate app_config.import_models() File "/home/me/PycharmProjects/myApp/venv/lib/python3.8/site-packages/django/apps/config.py", line 211, in import_models self.models_module = import_module(models_module_name) File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 783, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/home/me/PycharmProjects/myApp/venv/lib/python3.8/site-packages/auditlog/models.py", line 13, in <module> from django.utils.encoding import python_2_unicode_compatible, smart_text ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding' (/home/me/PycharmProjects/myApp/venv/lib/python3.8/site-packages/django/utils/encoding.py)
Hi,
Hi,
I am running python 3.8, django 3 and django-auditlog 0.4.5 (latest pip and PyCharm know about).
When I try to do a clean
python manage.py makemigrations ...
I get:Traceback (most recent call last): File "manage.py", line 22, in <module> execute_from_command_line(sys.argv) File "/home/me/PycharmProjects/myApp/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line utility.execute() File "/home/me/PycharmProjects/myApp/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 377, in execute django.setup() File "/home/me/PycharmProjects/myApp/venv/lib/python3.8/site-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/home/me/PycharmProjects/myApp/venv/lib/python3.8/site-packages/django/apps/registry.py", line 114, in populate app_config.import_models() File "/home/me/PycharmProjects/myApp/venv/lib/python3.8/site-packages/django/apps/config.py", line 211, in import_models self.models_module = import_module(models_module_name) File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 783, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/home/me/PycharmProjects/myApp/venv/lib/python3.8/site-packages/auditlog/models.py", line 13, in <module> from django.utils.encoding import python_2_unicode_compatible, smart_text ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding' (/home/me/PycharmProjects/myApp/venv/lib/python3.8/site-packages/django/utils/encoding.py)
Hi, try running the command as: pip install django-oscar[sorl-thumbnail]
from django.utils.six import python_2_unicode_compatible
instead of
from django.utils.encoding import python_2_unicode_compatible
and let me know if this works.
Hi, try to use command: pip install django-oscar[sorl-thumbnail]
I am still getting the error in RHEL 7 after trying able solution
category-encoders 2.2.2 pypi_0 pypi
certifi 2021.5.30 py37h06a4308_0 http://zxxxxxx/repository/conda/main
cx_oracle 8.2.1 py37h27cfd23_0 http://xxxxxxx/repository/conda/main
django 2.2.1 pypi_0 pypi
django-extra-views 0.13.0 pypi_0 pypi
django-filter 2.4.0 py_0 http://xxxxxxxx/repository/conda-forge
django-haystack 3.0 pypi_0 pypi
django-oscar 3.0.2 pypi_0 pypi
django-phonenumber-field 3.0.1 pypi_0 pypi
django-pyodbc 1.1.3 pypi_0 pypi
django-pyodbc-azure 1.2.5 pypi_0 pypi
django-request-logging 0.7.3 pypi_0 pypi
django-restql 0.13.1 pypi_0 pypi
django-tables2 2.3.4 pypi_0 pypi
django-treebeard 4.4 pypi_0 pypi
django-widget-tweaks 1.4.8 pypi_0 pypi
djangorestframework 3.9.4 pypi_0 pypi
djangorestframework-simplejwt 4.7.1
$ pip install django-oscar[sorl-thumbnail]
Looking in indexes: http://repository.xxxxxxxxxxx.com/repository/pypi/simple
Collecting django-oscar[sorl-thumbnail]
Downloading http://repository.xxxxxxxxxxx.com/repository/pypi/packages/django-oscar/3.0.2/django_oscar-3.0.2-py3-none-any.whl (9.1 MB)
|████████████████████████████████| 9.1 MB 5.4 MB/s
Collecting purl>=0.7
Downloading http://repository.xxxxxxxxxxx.com/repository/pypi/packages/purl/1.6/purl-1.6-py2.py3-none-any.whl (10 kB)
Collecting django-widget-tweaks>=1.4.1
Downloading http://repository.xxxxxxxxxxx.com/repository/pypi/packages/django-widget-tweaks/1.4.8/django_widget_tweaks-1.4.8-py2.py3-none-any.whl (11 kB)
Collecting factory-boy<3.0,>=2.4.1
Downloading http://repository.xxxxxxxxxxx.com/repository/pypi/packages/factory-boy/2.12.0/factory_boy-2.12.0-py2.py3-none-any.whl (36 kB)
Collecting pillow>=6.0
Downloading http://repository.xxxxxxxxxxx.com/repository/pypi/packages/pillow/8.2.0/Pillow-8.2.0-cp37-cp37m-manylinux1_x86_64.whl (3.0 MB)
|████████████████████████████████| 3.0 MB 2.5 MB/s
Collecting django-tables2<2.4,>=2.3
Downloading http://repository.xxxxxxxxxxx.com/repository/pypi/packages/django-tables2/2.3.4/django_tables2-2.3.4-py2.py3-none-any.whl (91 kB)
|████████████████████████████████| 91 kB 1.7 MB/s
Collecting django-phonenumber-field<4.0.0,>=3.0.0
Downloading http://repository.xxxxxxxxxxx.com/repository/pypi/packages/django-phonenumber-field/3.0.1/django_phonenumber_field-3.0.1-py3-none-any.whl (49 kB)
|████████████████████████████████| 49 kB 1.7 MB/s
Collecting Babel<3.0,>=1.0
Downloading http://repository.xxxxxxxxxxx.com/repository/pypi/packages/babel/2.9.1/Babel-2.9.1-py2.py3-none-any.whl (8.8 MB)
|████████████████████████████████| 8.8 MB 7.3 MB/s
Requirement already satisfied: django<3.2,>=2.2 in /apps/anaconda3/envs/bedofroses/lib/python3.7/site-packages (from django-oscar[sorl-thumbnail]) (3.1)
Collecting django-extra-views<0.14,>=0.13
Downloading http://repository.xxxxxxxxxxx.com/repository/pypi/packages/django-extra-views/0.13.0/django-extra-views-0.13.0.tar.gz (13 kB)
Collecting django-haystack>=3.0b1
Downloading http://repository.xxxxxxxxxxx.com/repository/pypi/packages/django-haystack/3.0/django-haystack-3.0.tar.gz (450 kB)
|████████████████████████████████| 450 kB 1.6 MB/s
Collecting django-treebeard<4.5,>=4.3
Downloading http://repository.xxxxxxxxxxx.com/repository/pypi/packages/django-treebeard/4.4/django_treebeard-4.4-py3-none-any.whl (103 kB)
|████████████████████████████████| 103 kB 2.8 MB/s
Collecting phonenumbers
Downloading http://repository.xxxxxxxxxxx.com/repository/pypi/packages/phonenumbers/8.12.26/phonenumbers-8.12.26-py2.py3-none-any.whl (2.6 MB)
|████████████████████████████████| 2.6 MB 1.9 MB/s
Collecting sorl-thumbnail<12.7,>=12.6
Downloading http://repository.xxxxxxxxxxx.com/repository/pypi/packages/sorl-thumbnail/12.6.3/sorl_thumbnail-12.6.3-py3-none-any.whl (41 kB)
|████████████████████████████████| 41 kB 3.2 MB/s
Requirement already satisfied: pytz>=2015.7 in /apps/anaconda3/envs/bedofroses/lib/python3.7/site-packages (from Babel<3.0,>=1.0->django-oscar[sorl-thumbnail]) (2021.1)
Requirement already satisfied: sqlparse>=0.2.2 in /apps/anaconda3/envs/bedofroses/lib/python3.7/site-packages (from django<3.2,>=2.2->django-oscar[sorl-thumbnail]) (0.4.1)
Collecting asgiref~=3.2.10
Downloading http://repository.xxxxxxxxxxx.com/repository/pypi/packages/asgiref/3.2.10/asgiref-3.2.10-py3-none-any.whl (19 kB)
Requirement already satisfied: six>=1.5.2 in /apps/anaconda3/envs/bedofroses/lib/python3.7/site-packages (from django-extra-views<0.14,>=0.13->django-oscar[sorl-thumbnail]) (1.16.0)
Collecting Faker>=0.7.0
Downloading http://repository.xxxxxxxxxxx.com/repository/pypi/packages/faker/8.8.2/Faker-8.8.2-py3-none-any.whl (1.2 MB)
|████████████████████████████████| 1.2 MB 1.8 MB/s
Requirement already satisfied: python-dateutil>=2.4 in /apps/anaconda3/envs/bedofroses/lib/python3.7/site-packages (from Faker>=0.7.0->factory-boy<3.0,>=2.4.1->django-oscar[sorl-thumbnail]) (2.8.1)
Collecting text-unidecode==1.3
Downloading http://repository.xxxxxxxxxxx.com/repository/pypi/packages/text-unidecode/1.3/text_unidecode-1.3-py2.py3-none-any.whl (78 kB)
|████████████████████████████████| 78 kB 785 kB/s
Building wheels for collected packages: django-extra-views, django-haystack
Building wheel for django-extra-views (setup.py) ... done
Created wheel for django-extra-views: filename=django_extra_views-0.13.0-py2.py3-none-any.whl size=15473 sha256=6db44e2ac8377d88d2079f144e8c84f77de58e238c5a99acee137885d228eb28
Stored in directory: /home/xxxxxxxxxxx/.cache/pip/wheels/6f/7c/5e/5c7526929ef9ffdd636debc10e435d4739f34fbe449254ad2b
Building wheel for django-haystack (setup.py) ... done
Created wheel for django-haystack: filename=django_haystack-3.0-py3-none-any.whl size=135116 sha256=21deaacf0ed6d7e9149630c962c72e6373c148fa40758f2fcea8c7d707c3ce6d
Stored in directory: /home/xxxxxxxxxxx/.cache/pip/wheels/7b/18/db/12db0d2954bb60e0c10b493be27d6601eaca6107595318b7a7
Successfully built django-extra-views django-haystack
Installing collected packages: text-unidecode, asgiref, Faker, Babel, purl, pillow, phonenumbers, factory-boy, django-widget-tweaks, django-treebeard, django-tables2, django-phonenumber-field, django-haystack, django-extra-views, sorl-thumbnail, django-oscar
Attempting uninstall: asgiref
Found existing installation: asgiref 3.3.4
Uninstalling asgiref-3.3.4:
Successfully uninstalled asgiref-3.3.4
Successfully installed Babel-2.9.1 Faker-8.8.2 asgiref-3.2.10 django-extra-views-0.13.0 django-haystack-3.0 django-oscar-3.0.2 django-phonenumber-field-3.0.1 django-tables2-2.3.4 django-treebeard-4.4 django-widget-tweaks-1.4.8 factory-boy-2.12.0 phonenumbers-8.12.26 pillow-8.2.0 purl-1.6 sorl-thumbnail-12.6.3 text-unidecode-1.3
You have mail in /var/spool/mail/xxxxxxxxxxx
(bedofroses) [xxxxxxxxxxx@lnxdevvm844 covid_data_api]$ python manage_covid_data_api.py runserver localhost:5034
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/home/xxxxxxxxxxx/anaconda3/envs/bedofroses/lib/python3.7/threading.py", line 926, in _bootstrap_inner
self.run()
File "/home/xxxxxxxxxxx/anaconda3/envs/bedofroses/lib/python3.7/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/home/xxxxxxxxxxx/anaconda3/envs/bedofroses/lib/python3.7/site-packages/django/utils/autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "/home/xxxxxxxxxxx/anaconda3/envs/bedofroses/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 110, in inner_run
autoreload.raise_last_exception()
File "/home/xxxxxxxxxxx/anaconda3/envs/bedofroses/lib/python3.7/site-packages/django/utils/autoreload.py", line 76, in raise_last_exception
raise _exception[1]
File "/home/xxxxxxxxxxx/anaconda3/envs/bedofroses/lib/python3.7/site-packages/django/core/management/__init__.py", line 357, in execute
autoreload.check_errors(django.setup)()
File "/home/xxxxxxxxxxx/anaconda3/envs/bedofroses/lib/python3.7/site-packages/django/utils/autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "/home/xxxxxxxxxxx/anaconda3/envs/bedofroses/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/xxxxxxxxxxx/anaconda3/envs/bedofroses/lib/python3.7/site-packages/django/apps/registry.py", line 114, in populate
app_config.import_models()
File "/home/xxxxxxxxxxx/anaconda3/envs/bedofroses/lib/python3.7/site-packages/django/apps/config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "/home/xxxxxxxxxxx/anaconda3/envs/bedofroses/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/xxxxxxxxxxx/anaconda3/envs/bedofroses/lib/python3.7/site-packages/rest_framework/authtoken/models.py", line 6, in <module>
from django.utils.encoding import python_2_unicode_compatible
ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding' (/home/xxxxxxxxxxx/anaconda3/envs/bedofroses/lib/python3.7/site-packages/django/utils/encoding.py)
Hi,
I am running python 3.8, django 3 and django-auditlog 0.4.5 (latest pip and PyCharm know about).
When I try to do a clean
python manage.py makemigrations ...
I get: