question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Import issues with python_2_unicode_compatible

See original GitHub issue

Django = 3.1.1 django-auditlog = 0.4.7

Error Messages:

redacted\lib\site-packages\auditlog\registry.py", line 5, in <module> from django.utils.six import iteritems ModuleNotFoundError: No module named ‘django.utils.six’

Fixed by installing django-utils-six ~= 2.0 pip install django-utils-six

redacted\lib\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’ (redacted\lib\site-packages\django\utils\encoding.py)

and

replace: from django.utils.encoding import python_2_unicode_compatible with: from six import python_2_unicode_compatible

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
lijiapengsacommented, Nov 27, 2020

use django-auditlog==1.0a1

1reaction
i-jonathancommented, Oct 8, 2020

On further checking, the current branch doesn’t include references to django.utils.six Installing from pip however still brings the fault

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - python_2_unicode_compatible error - Stack Overflow
I have founded same problem : from django.utils.encoding import python_2_unicode_compatible ImportError: cannot import name ...
Read more >
cannot import name 'python_2_unicode_compatible ... - GitHub
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...
Read more >
python_2_unicode_compatible error - Google Groups
I've "models.py" as follows, #encoding: utf-8 from django.contrib.auth.models import User from django.db import models
Read more >
cannot import name 'python_2_unicode_compatible' from ...
but I'm facing an error when I migrate my models, from django.utils.encoding import python_2_unicode_compatible ImportError: cannot import ...
Read more >
cannot import name 'python_2_unicode_compatible' - YouTube
Django : Django ImportError: cannot import name ... If there any issues, contact us on - htfyc dot hows dot tech ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found