Skip to content

day4测试代码出现'yield from' inside async function #47

Description

@ruin1990

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')

u = User(name='Test', email='test@example.com', passwd='1234567890', image='about:blank')

yield from u.save()

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版本的问题

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions