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
AttributeError: 'ThreadedDict' object has no attribute 'app_stack' #268
Comments
I had the same problem |
I have the same issue with web.py 0.37 version. I've got my code from an example:
And getting error:
|
Anybody found a solution? |
This question is hard. I also met when 2013 year. |
Use requests library instead app.request.
|
@dinodouglasr we can't limit the client request method. |
@Ravil-Safin Did you find the solution finally? |
I found a solution (https://www.itcao.com/post_1182.html) mark it |
I encountered this problem. anyone has any suggestions? |
well, seems to be a gevent bug. put these line before everything
works for me |
@cclauss could you help check this issue? I can reproduce it with py2 and py3 with the sample code given by @Ravil-Safin #268 (comment) |
Can you please create a PR that contains the failing test so that we all have a common playground for trying out solutions? |
@cclauss Use this code snippet:
|
We should try out this style of solution... |
|
Replying to the correct issue with a solution discussed in another issue. |
Could you help create a PR for this change? |
@iredmail In that example you posted above, isn't the issue created because the sample code uses import-time side-effect to invoke the app (which triggers a nested request)? If you change the code to this (to avoid import web
class hello:
def GET(self):
web.header('Content-Type', 'text/plain')
return "Hello world!"
urls = ('/hello', hello)
app = web.application(urls, {})
response = app.request("/hello") |
There is a related issue with # -*- coding: utf-8 -*-
from __future__ import print_function
import web
class inner:
def GET(self):
web.header("Content-Type", "text/plain")
return "This is the `inner` app!"
inner_app = web.application(("/", inner), {})
class outer:
def GET(self):
web.header("Content-Type", "text/plain")
inner_app.request("/")
return "This is the `outer` app!"
outer_app = web.application(("/", outer), {})
print("RESPONSE:", outer_app.request("/").data) |
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/web.py-0.37-py2.7.egg/web/application.py", line 237, in process
return p(lambda: process(processors))
File "/usr/local/lib/python2.7/dist-packages/web.py-0.37-py2.7.egg/web/application.py", line 591, in processor
h()
File "/usr/local/lib/python2.7/dist-packages/web.py-0.37-py2.7.egg/web/application.py", line 98, in _unload
web.ctx.app_stack = web.ctx.app_stack[:-1]
AttributeError: 'ThreadedDict' object has no attribute 'app_stack'
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/web.py-0.37-py2.7.egg/web/application.py", line 237, in process
return p(lambda: process(processors))
File "/usr/local/lib/python2.7/dist-packages/web.py-0.37-py2.7.egg/web/application.py", line 566, in processor
return handler()
File "/usr/local/lib/python2.7/dist-packages/web.py-0.37-py2.7.egg/web/application.py", line 237, in
return p(lambda: process(processors))
File "/usr/local/lib/python2.7/dist-packages/web.py-0.37-py2.7.egg/web/application.py", line 246, in process
raise self.internalerror()
File "/usr/local/lib/python2.7/dist-packages/web.py-0.37-py2.7.egg/web/application.py", line 473, in internalerror
parent = self.get_parent_app()
File "/usr/local/lib/python2.7/dist-packages/web.py-0.37-py2.7.egg/web/application.py", line 458, in get_parent_app
if self in web.ctx.app_stack:
AttributeError: 'ThreadedDict' object has no attribute 'app_stack'
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/gevent-1.0-py2.7-linux-x86_64.egg/gevent/pywsgi.py", line 508, in handle_one_response
self.run_application()
File "/usr/local/lib/python2.7/dist-packages/gevent-1.0-py2.7-linux-x86_64.egg/gevent/pywsgi.py", line 494, in run_application
self.result = self.application(self.environ, self.start_response)
File "/usr/local/lib/python2.7/dist-packages/web.py-0.37-py2.7.egg/web/application.py", line 279, in wsgi
result = self.handle_with_processors()
File "/usr/local/lib/python2.7/dist-packages/web.py-0.37-py2.7.egg/web/application.py", line 249, in handle_with_processors
return process(self.processors)
File "/usr/local/lib/python2.7/dist-packages/web.py-0.37-py2.7.egg/web/application.py", line 246, in process
raise self.internalerror()
File "/usr/local/lib/python2.7/dist-packages/web.py-0.37-py2.7.egg/web/application.py", line 473, in internalerror
parent = self.get_parent_app()
File "/usr/local/lib/python2.7/dist-packages/web.py-0.37-py2.7.egg/web/application.py", line 458, in get_parent_app
if self in web.ctx.app_stack:
AttributeError: 'ThreadedDict' object has no attribute 'app_stack'
{'CONTENT_LENGTH': '0',
'CONTENT_TYPE': 'application/x-www-form-urlencoded',
'GATEWAY_INTERFACE': 'CGI/1.1',
'HTTP_CACHE_CONTROL': 'no-cache',
'HTTP_CONNECTION': 'close',
'HTTP_COOKIE': '',
'HTTP_HOST': 'test.com',
'HTTP_USER_AGENT': 'Internet',
'HTTP_X_FORWARDED_FOR': '...',
'HTTP_X_REAL_IP': '...',
'PATH_INFO': '/test',
'QUERY_STRING': '',
'REMOTE_ADDR': '127.0.0.1',
'REMOTE_PORT': '58279',
'REQUEST_METHOD': 'POST',
'SCRIPT_NAME': '',
'SERVER_NAME': 'localhost',
'SERVER_PORT': '8058',
'SERVER_PROTOCOL': 'HTTP/1.1',
'SERVER_SOFTWARE': 'gevent/1.0 Python/2.7',
'wsgi.errors': <open file '', mode 'w' at 0x7ff36ea49270>,
'wsgi.input': <gevent.pywsgi.Input object at 0x2b83250>,
'wsgi.multiprocess': False,
'wsgi.multithread': False,
'wsgi.run_once': False,
'wsgi.url_scheme': 'http',
'wsgi.version': (1, 0)} failed with AttributeError
web server is gevent(1.0), The "/test" interface has been reported that the call was wrong
The text was updated successfully, but these errors were encountered: