# python\_2\_unicode\_compatible

**URL:** <https://forum.djangoproject.com/t/python-2-unicode-compatible/715>\
**Category:** Using Django\
**Created:** [December 27, 2019, 12:12pm UTC](https://forum.djangoproject.com/t/python-2-unicode-compatible/715 "2019-12-27T12:12:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marlon01](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/marlon01/32/486_2.png) [@marlon01](https://forum.djangoproject.com/u/marlon01)\
**Post date:** [December 27, 2019, 12:12pm UTC](https://forum.djangoproject.com/t/python-2-unicode-compatible/715/1 "2019-12-27T12:12:33Z")

</div>

from django.utils.encoding import python\_2\_unicode\_compatible  
ImportError: cannot import name ‘python\_2\_unicode\_compatible’ from ‘django.utils.encoding’ (/home/marlon/myblog/lib/python3.7/site-packages/django/utils/encoding.py)

---

<div class="post-metadata">

**Author:** ![Ookma-Kyi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/ookma-kyi/32/1091_2.png) [@Ookma-Kyi](https://forum.djangoproject.com/u/Ookma-Kyi)\
**Post date:** [December 28, 2019, 11:22am UTC](https://forum.djangoproject.com/t/python-2-unicode-compatible/715/2 "2019-12-28T11:22:02Z")

</div>

try

```auto
from django.utils.six import python_2_unicode_compatible

```

instead of

```auto
from django.utils.encoding import python_2_unicode_compatible

```

and let me know if this works.

---

<div class="post-metadata">

**Author:** ![mblayman](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/mblayman/32/101_2.png) [@mblayman](https://forum.djangoproject.com/u/mblayman)\
**Post date:** [December 28, 2019, 3:11pm UTC](https://forum.djangoproject.com/t/python-2-unicode-compatible/715/3 "2019-12-28T15:11:44Z")

</div>

`django.utils.encoding.python_2_unicode_compatible` was removed in Django 3.0. As the release documentation mentions, it was an alias to `six.python_2_unicode_compatible`. [https://docs.djangoproject.com/en/dev/releases/3.0/#removed-private-python-2-compatibility-apis](https://docs.djangoproject.com/en/dev/releases/3.0/#removed-private-python-2-compatibility-apis)

The suggestion made by @Ookma-Kyi should work.

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [May 27, 2020, 4:48pm UTC](https://forum.djangoproject.com/t/python-2-unicode-compatible/715/4 "2020-05-27T16:48:34Z")

</div>

For those finding this in the future, [django.utils.six was dropped in Django 3.0](https://docs.djangoproject.com/en/3.0/releases/3.0/#removed-private-python-2-compatibility-apis).

I’ve just been using [six](https://pypi.org/project/six/).
