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

AttributeError: module 'typing' has no attribute 'AsyncGenerator' #187

Closed
msterzhang opened this Issue Nov 3, 2018 · 3 comments

Comments

4 participants
@msterzhang
Copy link

msterzhang commented Nov 3, 2018

1.my code

#   -*-coding:utf-8 -*-
#   @Author: 'ZLOE'
#   @Time: '2018/11/3 22:26'
import responder


api = responder.API()

@api.route("/")
def hello_world(req, resp):
	resp.text = "hello, world!"



if __name__ == '__main__':
	api.run()

2.Error

D:\python\python.exe E:/python/requests框架/respond/index.py
Traceback (most recent call last):
  File "E:/python/requests框架/respond/index.py", line 4, in <module>
	import responder
  File "E:\python\requests框架\respond\responder\__init__.py", line 1, in <module>
	from .core import *
  File "E:\python\requests框架\respond\responder\core.py", line 1, in <module>
	from .api import API
  File "E:\python\requests框架\respond\responder\api.py", line 16, in <module>
	from starlette.exceptions import ExceptionMiddleware
  File "D:\python\lib\site-packages\starlette\exceptions.py", line 5, in <module>
	from starlette.debug import get_debug_response
  File "D:\python\lib\site-packages\starlette\debug.py", line 5, in <module>
	from starlette.requests import Request
  File "D:\python\lib\site-packages\starlette\requests.py", line 8, in <module>
	from starlette.formparsers import FormParser, MultiPartParser
  File "D:\python\lib\site-packages\starlette\formparsers.py", line 62, in <module>
	class FormParser:
  File "D:\python\lib\site-packages\starlette\formparsers.py", line 64, in FormParser
	self, headers: Headers, stream: typing.AsyncGenerator[bytes, None]
AttributeError: module 'typing' has no attribute 'AsyncGenerator'

Process finished with exit code 1
@hartym

This comment has been minimized.

Copy link

hartym commented Nov 3, 2018

What python version are you using?
typing.AsyncGenerator was introduced in python 3.5.4, and responder / starlette only support Python 3.6+, that's maybe your problem?

@msterzhang

This comment has been minimized.

Copy link

msterzhang commented Nov 3, 2018

python3.6
snipaste_2018-11-03_23-05-34

@duobei

This comment has been minimized.

Copy link

duobei commented Nov 22, 2018

python3.6
snipaste_2018-11-03_23-05-34

我试了下,Python 3.6.0 不行,Python 3.7.1 就可以了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment