{"id":1263,"date":"2014-08-04T13:06:29","date_gmt":"2014-08-04T05:06:29","guid":{"rendered":"http:\/\/blog.dayandcarrot.net\/?p=1263"},"modified":"2014-08-04T13:06:29","modified_gmt":"2014-08-04T05:06:29","slug":"attributeerror-module-object-has-no-attribute-af_inet","status":"publish","type":"post","link":"https:\/\/dayandcarrot.space\/?p=1263","title":{"rendered":"AttributeError: &#039;module&#039; object has no attribute &#039;AF_INET&#039;"},"content":{"rendered":"<p>\u4e3b\u8981\u75c7\u72b6\u5982\u4e0b\uff1a<\/p>\n<pre class=\"lang:default decode:true \">Traceback (most recent call last):\n  File \"C:Documents and SettingsaDesktopsocket.py\", line 1, in &lt;module&gt;\n    import socket\n  File \"C:Documents and SettingsaDesktopsocket.py\", line 6, in &lt;module&gt;\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\nAttributeError: 'module' object has no attribute 'AF_INET'<\/pre>\n<p>\u539f\u56e0\uff1a<br \/>\n\u81ea\u5df1\u7684\u6587\u4ef6\u540d\u53d8\u6210socket.py\u4e86\uff0cimport\u65f6\u7684\u5bfc\u5165\u5c31\u53d8\u6210\u4e86\u5bfc\u5165\u81ea\u5df1\u8fd9\u4e2a\u6587\u4ef6\uff0c\u7136\u540e\u5c31&#8230;.\u5475\u5475\u4e86<br \/>\n\u89e3\u51b3\u65b9\u6cd5\uff1a<br \/>\n\u6539\u4e2a\u6587\u4ef6\u540d\u5427~<br \/>\n&nbsp;<br \/>\n\u53c2\u8003\u6587\u732e\uff1a<a href=\"http:\/\/stackoverflow.com\/questions\/13422356\/socket-isnt-working-in-python\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/stackoverflow.com\/questions\/13422356\/socket-isnt-working-in-python<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e3b\u8981\u75c7\u72b6\u5982\u4e0b\uff1a Traceback (most recent call last): File &#8220;C:Documents and SettingsaDesktopsocket.py&#8221;, line 1, in &lt;module&gt; import socket File &#8220;C:Documents and SettingsaDesktopsocket.py&#8221;, line 6, in &lt;module&gt; s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) AttributeError: &#8216;module&#8217; object has no attribute &#8216;AF_INET&#8217; \u539f\u56e0\uff1a \u81ea\u5df1\u7684\u6587\u4ef6\u540d\u53d8\u6210socket.py\u4e86\uff0cimport\u65f6\u7684\u5bfc\u5165\u5c31\u53d8\u6210\u4e86\u5bfc\u5165\u81ea\u5df1\u8fd9\u4e2a\u6587\u4ef6\uff0c\u7136\u540e\u5c31&#8230;.\u5475\u5475\u4e86 \u89e3\u51b3\u65b9\u6cd5\uff1a \u6539\u4e2a\u6587\u4ef6\u540d\u5427~ &nbsp; \u53c2\u8003\u6587\u732e\uff1ahttp:\/\/stackoverflow.com\/questions\/13422356\/socket-isnt-working-in-python<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,8],"tags":[89,98],"class_list":["post-1263","post","type-post","status-publish","format-standard","hentry","category-study","category-technical","tag-python","tag-socket"],"_links":{"self":[{"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=\/wp\/v2\/posts\/1263","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1263"}],"version-history":[{"count":0,"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=\/wp\/v2\/posts\/1263\/revisions"}],"wp:attachment":[{"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1263"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}