所以即时尝试连接到使用此python库https://github.com/chrysn/aiocoap的CoaP资源。该库使用python 3.4,我已经安装了3.4,并设置为解释器来使用(在Windows 7 btw上)。执行clientGET.py文件时,仍然会收到此错误消息。相同的服务器文件。尝试使用python库连接到coap资源
C:\Python34\python.exe C:/Learning/PyCoap/aiocoap/clientGET.py
Traceback (most recent call last):
File "C:/Learning/PyCoap/aiocoap/clientGET.py", line 34, in <module>
asyncio.get_event_loop().run_until_complete(main())
File "C:\Python34\lib\asyncio\base_events.py", line 268, in run_until_complete
return future.result()
File "C:\Python34\lib\asyncio\futures.py", line 277, in result
raise self._exception
File "C:\Python34\lib\asyncio\tasks.py", line 236, in _step
result = next(coro)
File "C:/Learning/PyCoap/aiocoap/clientGET.py", line 20, in main
protocol = yield from Context.create_client_context()
File "C:\Learning\PyCoap\aiocoap\aiocoap\protocol.py", line 510, in create_client_context
transport, protocol = yield from loop.create_datagram_endpoint(protofact, family=socket.AF_INET6)
File "C:\Python34\lib\asyncio\base_events.py", line 675, in create_datagram_endpoint
waiter)
File "C:\Python34\lib\asyncio\selector_events.py", line 68, in _make_datagram_transport
address, waiter, extra)
File "C:\Python34\lib\asyncio\selector_events.py", line 911, in __init__
super().__init__(loop, sock, protocol, extra)
File "C:\Python34\lib\asyncio\selector_events.py", line 452, in __init__
self._extra['sockname'] = sock.getsockname()
OSError: [WinError 10022] Ein ungultiges Argument wurde angegeben
Process finished with exit code 1
感谢您花时间回答问题。太糟糕了,我需要这个项目已经结束了。对于跨平台的Python来说非常重要:) – Siniyas
我回答的原因很多,大致同样强烈;在阅读了一个有趣的问题后,为自己的好奇心服务,帮助其他可能有同样问题的人,并帮助提问人。 :-) – clacke
是的,Python是跨平台的一个点。某些事情在不同平台上的工作方式不同,无法轻松地桥接或抽象出来。当这种情况发生时,Windows通常是最不受关注的平台。 – clacke