-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
day4测试代码出现'yield from' inside async function #47
Comments
python 版本3.6以上才能在async里面使用yield async def test(loop): if name == 'main': |
接上文、主方法里面if name == ‘main’:需改为if name == 'main': |
前面的name是前后加双下划线、github给我自动转换了、 |
main前后也要双下划线、、 |
/Users/jiuxiaxixi/.conda/envs/webapp/bin/python /Users/jiuxiaxixi/PycharmProjects/webapp/www/testModel.py 运行你说的代码出现如下错误 |
发现代码没有关闭 数据库的连接 已经解决 |
clone工程变切换branch到day4运行以下测试代码
`
import orm
from models import User, Blog, Comment
def test():
yield from orm.create_pool(user='www-data', password='www-data', database='awesome')
for x in test():
pass
出现了这个错误在windows上,python3.6.2
$ python test_model.py
Traceback (most recent call last):
File "test_model.py", line 1, in
import orm
File "C:\Users\Administrator\Desktop\github\awesome-python3-webapp\www\orm.py", line 16
__pool = yield from aiomysql.create_pool(
^
SyntaxError: 'yield from' inside async function
`
查了2天资料没找到问题出在哪,不知道是不是python版本的问题
The text was updated successfully, but these errors were encountered: