You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import asyncio
import websockets
async def get_cells(websocket, path):
async for message in websocket:
... some code
async def get_shaded_area(websocket, path):
async for message in websocket:
... #some code
asyncio.get_event_loop().run_until_complete(
websockets.serve(get_cells, 'localhost', 8765))
asyncio.get_event_loop().run_until_complete(
websockets.serve(get_shaded_area, 'localhost/shade-area', 8765))
asyncio.get_event_loop().run_forever()
it started with only get_cells so it only had one get_event_loop for get_cells at that point it was working ok.
Since I want to make more that one ws connection since each handles different data and returns different results the second get_shaded_area after adding it throws this error:
(pixelart) sam@sam-Lenovo-G51-35:~/code/pixelart$ python path.py
Traceback (most recent call last):
File "path.py", line 144, in <module>
websockets.serve(get_shaded_area, 'localhost/shade-area', 8765))
File "/usr/lib/python3.6/asyncio/base_events.py", line 473, in run_until_complete
return future.result()
File "/usr/lib/python3.6/asyncio/tasks.py", line 537, in _wrap_awaitable
return (yield from awaitable.__await__())
File "/home/sam/code/envs/pixelart/lib/python3.6/site-packages/websockets/py35/server.py", line 13, in __await_impl__
server = await self._creating_server
File "/usr/lib/python3.6/asyncio/base_events.py", line 1019, in create_server
infos = yield from tasks.gather(*fs, loop=self)
File "/usr/lib/python3.6/asyncio/base_events.py", line 968, in _create_server_getaddrinfo
flags=flags, loop=self)
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
The text was updated successfully, but these errors were encountered:
Here's the snippet of code that I have
it started with only
get_cells
so it only had oneget_event_loop
forget_cells
at that point it was working ok.Since I want to make more that one ws connection since each handles different data and returns different results the second
get_shaded_area
after adding it throws this error:The text was updated successfully, but these errors were encountered: