对于AttributeError: ‘module’ object has no attribute ‘AF_INET’ 的错误原因
2015-05-14 10:45
671 查看
在python使用import socket后使用socket.AF_INET常量的时候发生在模块中找不到这个常量,很奇怪,在网上查了一下,在python import模块的时候会根据文件的名字进行导入,我的python脚本文件名字恰巧是socket.py,这才导致了导入的socket是错误的,尽量不要让自己的python脚本和模块同名,并且要注意同文件夹下的其他文件名和模块名是否冲突
本文出自 “Sanr” 博客,请务必保留此出处http://0x007.blog.51cto.com/6330498/1651179
本文出自 “Sanr” 博客,请务必保留此出处http://0x007.blog.51cto.com/6330498/1651179
相关文章推荐
- 对于AttributeError: ‘module’ object has no attribute ‘AF_INET
- AttributeError: 'module' object has no attribute 'AF_INET'处理办法——python
- web.py 启动时候出现AttributeError: 'module' object has no attribute 'inet_pton'错误
- web.py 启动时候出现AttributeError: 'module' object has no attribute 'inet_pton'错误
- import json后,报错:AttributeError: 'module' object has no attribute 'dumps,原因分析及解决方法
- 出现错误如下:AttributeError: 'module' object has no attribute 'SSL_ST_INIT'
- [python错误]builtins.AttributeError: 'module' object has no attribute 'request'
- python 错误解析 AttributeError: 'module' object has no attribute 'dumps'
- python错误:AttributeError: 'module' object has no attribute 'setdefaultencoding'问题的解决方法
- 关于Srapy框架运行的错误AttributeError: 'module' object has no attribute 'OP_NO_TLSv1_1'
- AttributeError: 'module' object has no attribute 'AF_INET'
- Python错误AttributeError: 'module' object has no attribute 'copy'
- python错误:AttributeError: 'module' object has no attribute 'setdefaultencoding'问题的解决方法
- import json后,报错:AttributeError: 'module' object has no attribute 'dumps,原因分析及解决方法
- Ubuntu16.04上启动Spyder出现错误AttributeError: 'module' object has no attribute '_base'
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- Django报错:AttributeError: 'module' object has no attribute 的解决方法
- AttributeError: 'module' object has no attribute 'text_format'
- web.py 直接使用示例代码,web.application报错, 'module' object has no attribute 'application',问题原因分析
- 【python】AttributeError: 'module' object has no attribute 'HTTPSConnection'