python - Greenlet exceptions suppressed in gevent + tornado setup -


when running tornado's wsgiapplication through gevent's pywsgi server, exceptions in greenlets suppressed , not show in standard error/output. have looked , looked , couldn't find why happening.

here's little test app demonstrate:

#!/usr/bin/env python  import gevent.monkey gevent.monkey.patch_all()  import gevent.wsgi import tornado.web import tornado.wsgi  class mainhandler(tornado.web.requesthandler):   def prepare(self):     # next line cause nameerror     = i_dont_exist_here  class app(tornado.wsgi.wsgiapplication):   def __init__(self):     tornado.wsgi.wsgiapplication.__init__(self, [(r"/", mainhandler)])  if __name__ == '__main__':   gevent.wsgi.wsgiserver(('', 80), app()).serve_forever() 

have tried running tornado.options.parse_command_line()?

#!/usr/bin/env python # -*- coding: utf-8 -*-  import gevent.monkey gevent.monkey.patch_all()  import gevent.wsgi import tornado.web import tornado.wsgi  tornado.options import parse_command_line tornado.options.parse_command_line()  class mainhandler(tornado.web.requesthandler):     def get(self):         raise exception("something terrible happened here")  class app(tornado.wsgi.wsgiapplication):     def __init__(self):         tornado.wsgi.wsgiapplication.__init__(self, [(r"/", mainhandler)])  if __name__ == '__main__':     gevent.wsgi.wsgiserver(('', 8000), app()).serve_forever() 

output:

[e 130819 00:11:27 web:1228] uncaught exception / (127.0.0.1)     <tornado.wsgi.httprequest object @ 0x0000000003009a20>     traceback (most recent call last):       file "c:\python27\lib\site-packages\tornado\web.py", line 1141, in _when_complete         callback()       file "c:\python27\lib\site-packages\tornado\web.py", line 1162, in _execute_method         self._when_complete(method(*self.path_args, **self.path_kwargs),       file "test.py", line 16, in         raise exception("something terrible happened here")     exception: terrible happened here 127.0.0.1 - - [2013-08-19 00:11:27] "get / http/1.1" 500 93 "-" "mozilla/5.0 (wi ndows nt 6.1; wow64; rv:23.0) gecko/20100101 firefox/23.0" 

Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -