AttributeError: 'thread._local' object has no attribute 'request'

539 views
Skip to first unread message

JungHyun Kim

unread,
May 15, 2012, 11:20:00 PM5/15/12
to web...@googlegroups.com
Hi. 

I got a error "AttributeError: 'thread._local' object has no attribute 'request'" when trying to run web2py with wsgi.

The application was "welcome" which is sample application of web2py.

in db.py
from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
auth = Auth(db, hmac_key=Auth.get_or_create_key())


and in gluon/tools.py
@staticmethod
   
def get_or_create_key(filename=None):
        request = current.request


Variables
global current<thread._local object>
requestundefined
current.requestundefined

I have two questions about this.

1. Does global current variable mean thread._local ?

2. If then, why thread._local doesn't have request attribute? Did I set wsgi configuration wrong?


Thank you very much.


Massimo Di Pierro

unread,
May 16, 2012, 11:34:54 AM5/16/12
to web...@googlegroups.com
what python version and os version do you have?

JungHyun Kim

unread,
May 16, 2012, 12:28:32 PM5/16/12
to web...@googlegroups.com

The server is Redhat Openshift (cloud PAAS). It uses Python 2.6 on RHEL 6.



2012년 5월 17일 목요일 오전 12시 34분 54초 UTC+9, Massimo Di Pierro 님의 말:

Massimo Di Pierro

unread,
May 16, 2012, 5:17:54 PM5/16/12
to web...@googlegroups.com
Any chance you can try 2.5 or 2.7?

JungHyun Kim

unread,
May 16, 2012, 10:33:24 PM5/16/12
to web...@googlegroups.com
Unfortunately, I can't. No way to change python version of the server.

But I tried with python 2.6 on my OS X. It works well.


2012년 5월 17일 목요일 오전 6시 17분 54초 UTC+9, Massimo Di Pierro 님의 말:

Massimo Di Pierro

unread,
May 16, 2012, 10:42:31 PM5/16/12
to web...@googlegroups.com
Somehow RH ships with a broken Python. Somehow I am not surprised.

JungHyun Kim

unread,
May 16, 2012, 10:59:14 PM5/16/12
to web...@googlegroups.com
LOL.

But someone in this user group already succeeded with openshift. 
So it might be my fault. I should find the answer more.

Thank you very much Massimo.



2012년 5월 17일 목요일 오전 11시 42분 31초 UTC+9, Massimo Di Pierro 님의 말:
Reply all
Reply to author
Forward
0 new messages