mqingyn / torngas

BSD 3-Clause "New" or "Revised" License
437 stars 137 forks source link

pip3 installed version doesn't support python 3? #14

Open BlueHoopor opened 6 years ago

BlueHoopor commented 6 years ago

I installed torgnas with pip3 (Python 3.6 + Tornado 4.3). The demo can't run because of Python 2.x syntax such as :

except Exception, e:

after using 2to3-3.6, still can't run, here is the tornado log :

_[E 171014 09:15:18 http1connection:54] Uncaught exception

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/tornado/http1connection.py", line 238, in _read_message
    delegate.finish()
  File "/usr/local/lib/python3.6/site-packages/tornado/routing.py", line 251, in finish
    self.delegate.finish()
  File "/usr/local/lib/python3.6/site-packages/tornado/web.py", line 2096, in finish
    self.execute()
  File "/usr/local/lib/python3.6/site-packages/tornado/web.py", line 2129, in execute
    **self.path_kwargs)
  File "/usr/local/lib/python3.6/site-packages/torngas/handler.py", line 44, in _execute
    with stack_context.StackContext(functools.partial(ThreadlocalLikeRequestContext, **current_context)):
  File "/usr/local/lib/python3.6/site-packages/tornado/stack_context.py", line 137, in __enter__
    self.enter()
  File "/usr/local/lib/python3.6/site-packages/tornado/stack_context.py", line 122, in enter
    context.__enter__()
  File "/usr/local/lib/python3.6/site-packages/torngas/utils.py", line 411, in __enter__
    self._prev_data = self.__class__.data
AttributeError: type object 'ThreadlocalLikeRequestContext' has no attribute 'data'_
leeyisoft commented 6 years ago

我也遇到同样的问题,求解决方法 @mqingyn

smoothjump commented 6 years ago

This is web.py demo

2018-02-24 16:19 GMT+08:00 leeyi notifications@github.com:

我也遇到同样的问题,求解决方法 @mqingyn https://github.com/mqingyn

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mqingyn/torngas/issues/14#issuecomment-368210485, or mute the thread https://github.com/notifications/unsubscribe-auth/AHleHXFFClsvH1yMqa5GbtsTeS2OKHmJks5tX8X7gaJpZM4P5SC_ .

leeyisoft commented 6 years ago

我没有用过 web.py ,不熟悉,能够解释的详细些吗? (我是想要在Python3下面把 torngas 正常运行起来,能够访问MySQL) @smoothjump @mqingyn

smoothjump commented 6 years ago

如果要在python3下面跑,不兼容的代码需要你自己改掉 或者你可以选择python 2.X,需要用python 2的解释器运行pip安装,3不是向后兼容的 以上的问题不是语法问题,ThreadlocalLikeRequestContext里面不存在‘data’属性,自己看代码吧

leeyisoft commented 6 years ago

tornado 现在都5.0了,据说Python3才是Python的未来,你不打算让torngas支持Python3吗?