Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Django 3.x - cannot import name 'curry' from 'django.utils.functional' #130

Closed
mohsen-hassani opened this issue Mar 25, 2020 · 8 comments · Fixed by #133
Closed

Django 3.x - cannot import name 'curry' from 'django.utils.functional' #130

mohsen-hassani opened this issue Mar 25, 2020 · 8 comments · Fixed by #133
Labels

Comments

@mohsen-hassani
Copy link

Describe the bug
ImportError: cannot import name 'curry' from 'django.utils.functional'

Reproduce behavior

  • Create new virtualenv
  • pip install django, pinax-blog
  • Create new project with django-admin
  • Add pinax.blog and pinax.images to INSTALLED_APPS
  • Add pinax.blog.urls to urlpatterns
  • replace: from django.utils.encoding import python_2_unicode_compatible
    with: from six import python_2_unicode_compatible due to this issue
  • run python3 manage.py runserver or python3 manage.py migrate
@KatherineMichel
Copy link
Member

It looks like this needs to be updated as part of dropping Python 2.x support. @mfonism has a branch in the works to do that, but I don't think curry has been updated yet. https://docs.djangoproject.com/en/3.0/releases/3.0/#removed-private-python-2-compatibility-apis
https://github.com/mfonism/pinax-blog/tree/2020.03.14/update-python-and-django-support

@tiholic
Copy link

tiholic commented Apr 6, 2020

@KatherineMichel
https://code.djangoproject.com/ticket/10479

You may simply change the imports from django.utils.functional import curry to from funtools import partial as curry

@KatherineMichel
Copy link
Member

@tiholic Thank you for that info! @mfonism has a PR in the works to update the test matrix for a new release. I will look into this. #129

@KatherineMichel
Copy link
Member

@mohsenone, @tiholic... a new release has been tagged and published. Thank you! https://pypi.org/project/pinax-blog/

@neilmillard
Copy link
Contributor

Managed to recreate this bug from a fresh 8.0.0 install.

File "/data/neil/.cache/pypoetry/virtualenvs/sc-blog-a7R5rCuA-py3.8/lib/python3.8/site-packages/pinax/blog/admin.py", line 3, in <module>
    from django.utils.functional import curry
ImportError: cannot import name 'curry' from 'django.utils.functional'

@mfonism
Copy link
Contributor

mfonism commented Jul 27, 2020

Oops! I inadvertently missed this one 🙈!!

Just bit me in a side project a few minutes ago... But I see you have a PR for this, @neilmillard.

@KatherineMichel
Copy link
Member

@mohsenone @neilmillard @tiholic @mfonism I am so sorry, everyone. I could have sworn I fixed this! Otherwise, would not have closed issue. Maybe I pushed to the wrong branch. I've merged @neilmillard's PR and published a new package. https://pypi.org/project/pinax-blog/8.0.1/

@nickmccullum
Copy link

@KatherineMichel https://code.djangoproject.com/ticket/10479

You may simply change the imports from django.utils.functional import curry to from funtools import partial as curry

In case anyone comes across this, the import is typod here and should be functools not funtool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants