Skip to content Skip to sidebar Skip to footer

Python_2_unicode_compatible Error

I've models.py as follows, from django.contrib.auth.models import User from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.utils.

Solution 1:

For the latest Django 3.0.4 , and auditlog try

from six import python_2_unicode_compatible

instead of

from django.utils.siximport python_2_unicode_compatible

if it is not install run the below code

pip install six

Solution 2:

try

from django.utils.siximport python_2_unicode_compatible

instead of

from django.utils.encodingimport python_2_unicode_compatible

this works well for me in Django 1.10.6

Solution 3:

Solution 4:

I faced the same issue when I upgraded the Django version 2.x to 3.x.

This issue, I faced due to auditlog library.

First, execute the below command

pip uninstall auditlog

then

pip install auditlog3

Solution 5:

I ran into this issue when I wanted to use Django for Graphite. Turns out I had Django 1.3 installed and my Graphite version was breaking with Django > 1.5, so installing the latest version of the 1.4 branch fixed the problem:

sudo pip install --upgrade 'Django<1.5'

Post a Comment for "Python_2_unicode_compatible Error"