所以即時嘗試連接到使用此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