object has no attribute 'bind'
wku opened this issue · 8 comments
Traceback (most recent call last):
File "/home/wku/anaconda3/lib/python3.6/site-packages/curio/kernel.py", line 826, in _run_coro
trap = current._send(current.next_value)
File "/home/wku/anaconda3/lib/python3.6/site-packages/curio/task.py", line 96, in _task_runner
return await coro
File "/home/wku/Рабочий стол/[project]/[project_work]/mini/speed_test/server_hyper2web/hyper2web-dev/hyper2web/server.py", line 24, in h2_server
sock = create_listening_ssl_socket(address, certfile, keyfile)
File "/home/wku/Рабочий стол/[project]/[project_work]/mini/speed_test/server_hyper2web/hyper2web-dev/hyper2web/sslsocket.py", line 23, in create_listening_ssl_socket
sock.bind(address)
AttributeError: 'coroutine' object has no attribute 'bind'
which version of curio are you using? I am not aware of this issue.
The direct problem here is that sock in your context is a coroutine, which of course doesn't have a bind method.
But, I don't know why sock = socket.socket() returns a coroutine. It's only possible if curio API changed.
Can you paste your code?
Error in Element
Master Game Example
Https://github.com/CreatCodeBuild/hyper2web/blob/master/example/game/app.py
/home/wku/anaconda3/bin/python "/home/wku/Рабочий стол/[project]/[project_work]/mini/speed_test/server_hyper2web-/hyper2web-dev/example/game/app.py"
init a new record
Traceback (most recent call last):
File "/home/wku/anaconda3/lib/python3.6/site-packages/curio/kernel.py", line 826, in _run_coro
trap = current._send(current.next_value)
File "/home/wku/anaconda3/lib/python3.6/site-packages/curio/task.py", line 96, in _task_runner
return await coro
File "/home/wku/anaconda3/lib/python3.6/site-packages/hyper2web/server.py", line 24, in h2_server
sock = create_listening_ssl_socket(address, certfile, keyfile)
File "/home/wku/anaconda3/lib/python3.6/site-packages/hyper2web/sslsocket.py", line 23, in create_listening_ssl_socket
sock.bind(address)
AttributeError: 'coroutine' object has no attribute 'bind'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/wku/Рабочий стол/[project]/[project_work]/mini/speed_test/server_hyper2web-/hyper2web-dev/example/game/app.py", line 43, in
app.up()
File "/home/wku/anaconda3/lib/python3.6/site-packages/hyper2web/app.py", line 94, in up
shutdown=True)
File "/home/wku/anaconda3/lib/python3.6/site-packages/curio/kernel.py", line 214, in run
raise TaskError('Task Crashed') from ret_exc
curio.errors.TaskError: Task Crashed
sys:1: RuntimeWarning: coroutine 'CurioSSLContext.wrap_socket' was never awaited
Process finished with exit code 1
curio.version
'0.7'
This is the ssl.py in Curio.
Your problem is related with issue 225 in Curio, which I just opened.
You can either switch to wip branch or change the source code of hyper2web.
Just in case you are new to coroutines, this is a great tutorial from the author of Curio.
Anyway, thank you very much for trying out my framework. Your feedback is the most valuable. Feel free to discuss anything related to this framework. (Feature requests, docs ...)
The issue has been fixed in master branch sslsocket.py
csock = ssl_context.wrap_socket(sock)
while True:
try:
csock.send(None)
except StopIteration as e:
sock = e.value
sock.bind(address)
sock.listen()
return sockI have not updated the repo on pypi yet. Will close this issue after pypi update.
Has pushed the fix to pypi