User_agent is NoneType error

31 views
Skip to first unread message

DaneW

unread,
Nov 17, 2017, 4:09:01 AM11/17/17
to web2py-users
I have recently started to get regular tickets for TypeErrorargument of type 'NoneType' is not iterable on user_agent.is_mobile = 'Mobile' in http_user_agent

1.
2.
3.
4.
5.
6.
7.
8.
Traceback (most recent call last):
File "/home/appgov/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
File "/home/appgov/web2py/applications/apg/views/default/index.html", line 62, in <module>
File "/home/appgov/web2py/gluon/globals.py", line 340, in user_agent
user_agent.is_mobile = 'Mobile' in http_user_agent
TypeError: argument of type 'NoneType' is not iterable
Variables
user_agent.is_mobileNone
http_user_agentNone
user_agent<Storage {'platform': <Storage {'version': None, 'name': None}>}>

I'm using 2.15.4 with Python 2.7 on PythonAnywhere.

Any suggestions?

Leonel Câmara

unread,
Nov 17, 2017, 1:20:41 PM11/17/17
to web2py-users
Can you upgrade to the latest version, restart, and check if this still happens? If it does, please file an issue in github explaining how to reproduce.

DaneW

unread,
Nov 20, 2017, 3:36:04 AM11/20/17
to web2py-users
Thanks. I have now upgraded to 2.16.1 but I'm afraid the problem is still there. The traceback is slightly different -

File "/home/appgov/web2py/gluon/globals.py", line 340, in user_agent
    user_agent = user_agent_parser.detect(http_user_agent)
TypeError: argument of type 'NoneType' is not iterable
The problem occurs when a user tries to access my home page (www.appgov.org) but other users get through successfully.

I will file the issue in GitHub.
Reply all
Reply to author
Forward
0 new messages