selwin / django-user_agents

A django package that allows easy identification of visitor's browser, OS and device information, including whether the visitor uses a mobile phone, tablet or a touch capable device.
MIT License
640 stars 104 forks source link

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

Open gregorysemah opened 3 years ago

gregorysemah commented 3 years ago

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)

GeekyShacklebolt commented 2 years ago

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.