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

ImportError: cannot import name 'ugettext' from 'django.utils.translation' and TypeError: Signal.__init__() got an unexpected keyword argument 'providing_args' #334

Open
Av1nag opened this issue Jul 18, 2024 · 2 comments

Comments

@Av1nag
Copy link

Av1nag commented Jul 18, 2024

I'm getting

`ImportError: cannot import name 'ugettext' from 'django.utils.translation' (C:\realtime-projects\python-django\.venv\Lib\site-packages\django\utils\translation\__init__.py). Did you mean: 'gettext'?`

To suppress that i've imported below libraries in settings.

import django
from django.utils.translation import gettext, gettext_lazy
django.utils.translation.ugettext = gettext
django.utils.translation.ugettext_lazy = gettext_lazy

Then, I got the same issue, which is
TypeError: Signal.__init__() got an unexpected keyword argument 'providing_args'

This issue is raising, when I'm adding "graphql_jwt.refresh_token.apps.RefreshTokenConfig" in INSTALLED_APPS of Django project.

More Details:

Libraries Version:
Django==5.0.7
django-filter==24.2
django-graphql-auth==0.3.16
django-graphql-jwt==0.3.0
graphene==2.1.9
graphene-django==2.16.0
graphql-core==2.3.2
graphql-relay==2.0.1

Commands to raise the issue:

Install the above libraries in existing django project and run python manage.py makemigrations

Originally posted by @Av1nag in #328 (comment)

@Av1nag Av1nag changed the title ImportError: cannot import name 'ugettext' from 'django.utils.translation' ImportError: cannot import name 'ugettext' from 'django.utils.translation' and TypeError: Signal.__init__() got an unexpected keyword argument 'providing_args' Jul 18, 2024
@monokrome
Copy link

In case it helps, I think you may have tried to update your requirements.txt or otherwise ended up in a situation where an upgrade left you at a lower version than the latest version. The issue occurred for me when you depend on django-rest-framework-jwt, which is currently unmaintained.

The django-rest-framework-jwt project is still depending on pyjwt<=2.0.0 while django-graphql-jwt is expecting a newer version. In order to remedy this, upgrading packages with pip will keep django-graphql-jwt at a lower version such as 0.2.2 in order to keep dependencies matching properly.

It seems like moving from django-rest-framework-jwt (or whichever old dependency you may have) could remedy the issue.

@Av1nag
Copy link
Author

Av1nag commented Jul 19, 2024

In case it helps, I think you may have tried to update your requirements.txt or otherwise ended up in a situation where an upgrade left you at a lower version than the latest version. The issue occurred for me when you depend on django-rest-framework-jwt, which is currently unmaintained.

The django-rest-framework-jwt project is still depending on pyjwt<=2.0.0 while django-graphql-jwt is expecting a newer version. In order to remedy this, upgrading packages with pip will keep django-graphql-jwt at a lower version such as 0.2.2 in order to keep dependencies matching properly.

It seems like moving from django-rest-framework-jwt (or whichever old dependency you may have) could remedy the issue.

If you're not using REST implementation in your project, I suggest you to remove django-rest-framework-jwt and upgrade django-graphql-jwt. I'm actually implementing only graphql APIs in my project. So, I've done that now it's working good with new version deps.

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

No branches or pull requests

2 participants