python 错误AttributeError: 'module' object has no attribute 'AF_INET'
写了一个简单的python socket的程序。运行时,报错如下
原因:文件的命名与Python的function的命名冲突
修改名称后,发现还是无法运行,检查目录下面是否有
这样子的一个文件,删除即可。
据我的理解,应该是我们自己命名重写了Python的socket函数。
附上我的小代码
- import socket
- mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- mysock.connect(('data.pr4e.org', 80))
- mysock.send('GET http://data.pr4e.org/intro-short.txt HTTP/1.0\n\n')
- while True:
- data = mysock.recv(512)
- if ( len(data) < 1 ) :
- break
- print data;
- mysock.close()
python 错误AttributeError: 'module' object has no attribute 'AF_INET'的更多相关文章
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
最近在编写Python脚本过程中遇到一个问题比较奇怪:Python脚本完全正常没问题,但执行总报错"AttributeError: 'module' object has no attrib ...
- python 脚本运行时报错: AttributeError: 'module' object has no attribute ***
最近在编写Python脚本过程中遇到一个问题比较奇怪:Python脚本完全正常没问题,但执行总报错"AttributeError: 'module' object has no attrib ...
- python文件名不要跟模块名相同,报错AttributeError: 'module' object has no attribute 'Differ'
python中的文件都会生成pyc文件,包括模块也是这样,所以调用模块的时候,实际上会调用模块.pyc文件:在这个前提下,如果将文件名命名成跟模块名一样,在同一目录下就会生成一个跟模块名一样的pyc文 ...
- Python AttributeError: 'Module' object has no attribute 'STARTF_USESHOWINDOW'
夫学须志也,才须学也,非学无以广才,非志无以成学.--诸葛亮 生活有度,自得慈铭 --杜锦阳 今天新来的同事安装环境遇到个莫名其妙的问题: AttributeError: 'Module' objec ...
- 【Python】【亲测好用】安装第三方包报错:AttributeError:'module' object has no attribute 'main'
安装/卸载第三包可能出现如下问题及相应解决办法: 在pycharm编辑中,使用anconda2更新.卸载第三方包时,出现如下错误: AttributeError:'module' object has ...
- python问题:AttributeError: 'module' object has no attribute 'SSL_ST_INIT'
AttributeError: 'module' object has no attribute 'SSL_ST_INIT' 问题背景: 下载工具wydomain,安装依赖包以后,出现下图问题. 几经 ...
- python问题:AttributeError: 'module' object has no attribute 'SSL_ST_INIT'(转)
原文地址:http://www.cnblogs.com/zhaijiahui/p/7344778.html AttributeError: 'module' object has no attribu ...
- AttributeError: 'module' object has no attribute 'enableTrace'
Traceback (most recent call last): File "Long-lived-connection.py", line 29, in <module ...
- 在运行create_list.sh时候报错:AttributeError: 'module' object has no attribute 'LabelMap'
Traceback (most recent call last):File "/opt/xuben-project/caffe/data/VOC0712/../../scripts/cre ...
随机推荐
- Servlet程序开发--Servlet 与 表单
servlet程序: doPost方法时为了防止表单提交时post方式的问题.否则只能处理get请求 package org.lxh.servletdemo ; import java.io.* ; ...
- C# 经典入门15章 -TabControl
- List转换成DataSet实现代码
public DataSet ConvertToDataSet<T>(IList<T> list) { if (list == null || list.Count <= ...
- Permission denied: user=xxj, access=WRITE, inode="user":hadoop:supergroup:rwxr-xr-x
在windows中运行eclipse时报错Permission denied: user=xxj, access=WRITE, inode="user":hadoop:superg ...
- android复习-AnsyTask
AnsyTask是一种类似Thread+Hander机制的处理耗时操作的类, 通过在UI线程中excute()启动操作, 在AnsyTask中 doInBackground()中处理耗时操作(运行在自 ...
- 基于Verilog HDL 的数字电压表设计
本次实验是在“基于Verilog HDL的ADC0809CCN数据采样”实验上进一步改进,利用ADC0809采集到的8位数据,进行BCD编码,以供查表方式相加进行显示,本次实验用三位数码管. ADC0 ...
- 2016"百度之星" - 资格赛(Astar Round1) Problem E
简单模拟题,耐心写就能过. #include <stdio.h> #include <math.h> #include<cstring> #include<c ...
- HDU 3265 Posters
矩形面积并,一个拆成四个 #include<cstdio> #include<cstring> #include<cmath> #include<map> ...
- Unity 之 c# 版的 CharacterMotor
using System; using System.Collections; using UnityEngine; // This class just convert from Character ...
- 浅谈Spring事务隔离级别
一.Propagation (事务的传播属性) Propagation : key属性确定代理应该给哪个方法增加事务行为.这样的属性最重要的部份是传播行为.有以下选项可供使用:PROPAGATION_ ...