質問編集履歴
1
Linuxにおいて不具合
test
CHANGED
File without changes
|
test
CHANGED
@@ -71,3 +71,67 @@
|
|
71
71
|
asyncioを初めて少ししか経っていない事もありエラーの意味を理解できず解決策がわからず困っています。
|
72
72
|
|
73
73
|
どうすればいいのでしょうか?宜しくお願いします。
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
## 追記
|
78
|
+
|
79
|
+
```python
|
80
|
+
|
81
|
+
from aiohttp import web
|
82
|
+
|
83
|
+
import asyncio
|
84
|
+
|
85
|
+
from threading import Thread
|
86
|
+
|
87
|
+
import time
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
def test(request):
|
94
|
+
|
95
|
+
return web.Response(text='Hello world.')
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
def server(host, port, loop):
|
102
|
+
|
103
|
+
asyncio.set_event_loop(loop)
|
104
|
+
|
105
|
+
app = web.Application()
|
106
|
+
|
107
|
+
app.router.add_get('/', test)
|
108
|
+
|
109
|
+
web.run_app(app, host=host, port=port)
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
# server("127.0.0.1", 2000)
|
116
|
+
|
117
|
+
loop = asyncio.get_event_loop()
|
118
|
+
|
119
|
+
Thread(
|
120
|
+
|
121
|
+
target=server,
|
122
|
+
|
123
|
+
args=("127.0.0.1", 2000, loop),
|
124
|
+
|
125
|
+
daemon=True).start()
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
while True:
|
130
|
+
|
131
|
+
time.sleep(5)
|
132
|
+
|
133
|
+
print("Sleeping..zzz")
|
134
|
+
|
135
|
+
```
|
136
|
+
|
137
|
+
Windowsで動作する事を確認した後、Ubuntuでも動作を確認した所、`RuntimeError: set_wakeup_fd only works in main thread`とエラーを吐きました。
|