django-mailbox icon indicating copy to clipboard operation
django-mailbox copied to clipboard

ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding'

Open jscpeterson opened this issue 4 years ago • 6 comments

django-mailbox==4.8.1

When running python manage.py migrate django_mailbox after installation and adding django_mailbox to INSTALLED_APPS, this error is returned

python manage.py migrate django_mailbox
Traceback (most recent call last):
  File "manage.py", line 24, in <module>
    main()
  File "manage.py", line 20, in main
    execute_from_command_line(sys.argv)
  File "/Users/joseph.peterson/Development/help-desk/env-helpdesk/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/Users/joseph.peterson/Development/help-desk/env-helpdesk/lib/python3.7/site-packages/django/core/management/__init__.py", line 377, in execute
    django.setup()
  File "/Users/joseph.peterson/Development/help-desk/env-helpdesk/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/joseph.peterson/Development/help-desk/env-helpdesk/lib/python3.7/site-packages/django/apps/registry.py", line 114, in populate
    app_config.import_models()
  File "/Users/joseph.peterson/Development/help-desk/env-helpdesk/lib/python3.7/site-packages/django/apps/config.py", line 211, in import_models
    self.models_module = import_module(models_module_name)
  File "/Users/joseph.peterson/Development/help-desk/env-helpdesk/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 "/Users/joseph.peterson/Development/help-desk/env-helpdesk/lib/python3.7/site-packages/django_mailbox/models.py", line 31, in <module>
    from django.utils.encoding import python_2_unicode_compatible
ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding'

jscpeterson avatar Mar 26 '20 17:03 jscpeterson

Which version of django?

Fixed in https://github.com/coddingtonbear/django-mailbox/commit/2b2b7d639236ecf615ffa510441f2163bb6de4a6 . Not released yet.

ad-m avatar Mar 26 '20 18:03 ad-m

Which version of django?

Fixed in 2b2b7d6 . Not released yet.

Django==3.0.2 Does it need to be downgraded in the meantime?

jscpeterson avatar Mar 26 '20 18:03 jscpeterson

The project is based on the work of volunteers who do not any receive payments for the development of django-mailbox. Instead of going back to previous version Django, I suggests joining to us and taking all necessary steps to preapre a new release (write changelog etc.), which will be a good first step to become a contributor of the project.

ad-m avatar Mar 26 '20 18:03 ad-m

@jscpeterson I installed via cloning the git repository instead of using pip which solved the problem you have here.

hughjward avatar Mar 31 '20 09:03 hughjward

I can confirm this for 4.8.1 when i install it via pip directly or with git from pip. Installation with pip3 install git+https://github.com/coddingtonbear/django-mailbox.git@c8751f0c9ae85e43f8e775e21dc5ad26adc7f459 it works.

ghost avatar Apr 14 '20 22:04 ghost

Yes, installing the latest version from git solves the problem for me.

mkayander avatar Jun 02 '20 08:06 mkayander

Fixed with the last release (maybe even before)

pfouque avatar Dec 11 '23 19:12 pfouque