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

InvalidTemplateLibrary raised, trying to load 'django_user_agents.templatetags.user_agents' (Django 3.0.7)

Open gregorysemah opened this issue 4 years ago • 1 comments

Hello,

Seems that Django 3.0.7 with python3.9 breaks things

Here is the error django.template.library.InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'django_user_agents.templatetags.user_agents': cannot import name 'get_and_set_user_agent' from partially initialized module 'django_user_agents.utils' (most likely due to a circular import) (/blablablablablabla/python3.9/site-packages/django_user_agents/utils.py)

The problem appears randomly by restarting runserver (run and debugger with pycharm)

gregorysemah avatar Dec 16 '20 11:12 gregorysemah

Hey,

I have been facing the same issue. with Python3.9.0 and Django3.2.10 (recently updated from 3.2.8). Was getting the error:

File "/.../.venv/lib/python3.9/site-packages/django_user_agents/templatetags/user_agents.py", line 3, in from ..utils import get_and_set_user_agent ImportError: cannot import name 'get_and_set_user_agent' from partially initialized module 'django_user_agents.utils' (most likely due to a circular import) (/.../.venv/lib/python3.9/site-packages/django_user_agents/utils.py)

I brought down the Django Version back to 3.2.8 that solves the problem for me.

GeekyShacklebolt avatar Dec 23 '21 16:12 GeekyShacklebolt