AttributeError:使用'with` statemens'时退出

2024-10-01 11:26:39 发布

您现在位置:Python中文网/ 问答频道 /正文

我用这个guide为SQLAlchemy编写了一个session_scope。当我运行代码时,我得到一个AttributeError异常:

Traceback (most recent call last):
  File "/Users/tuanchauict/workspace/opla-manga/python-server-non-django/demo.py", line 56, in <module>
    with session_scope() as s:
AttributeError: __exit__

我的代码是:

^{pr2}$

我在macos10.10上运行python3.4。在


Tags: 代码mostsqlalchemysessioncallusersworkspacefile