AttributeError: module 'shutil' has no attribute 'copyfileobj'
import shutil
#1.copyfileobj(源文件,目标文件) 将文件内容复制到另一个文件
shutil.copyfileobj(open('config.log','r'),open('pic.json','a'))
--------------------------------------------------------------------------------------------------------
以上代码在执行的时候报了错:
Traceback (most recent call last):
File "D:/Python/mypy/basic/shutil.py", line 4, in <module>
import shutil
File "D:\Python\mypy\basic\shutil.py", line 8, in <module>
shutil.copyfileobj(open('config.log','r'),open('pic.json','a'))
AttributeError: module 'shutil' has no attribute 'copyfileobj'
--------------------------------------------------------------------------------------------------------------------------------------------------------
很不能理解,上网一查,居然有人跟我一样,哈哈~
原因是这样滴:
我的文件,名字是shutil.py,而看上面的错误信息里面,是用一个import shutil,估计也是同样错误的把我的脚本当作官方库给错误引用了。
AttributeError: module 'shutil' has no attribute 'copyfileobj'的更多相关文章
- python中引入包的时候报错AttributeError: module 'sys' has no attribute 'setdefaultencoding'解决方法?
python中引入包的时候报错:import unittestimport smtplibimport timeimport osimport sysimp.reload(sys)sys.setdef ...
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
最近在编写Python脚本过程中遇到一个问题比较奇怪:Python脚本完全正常没问题,但执行总报错"AttributeError: 'module' object has no attrib ...
- attributeError:'module' object has no attribute ** 解决办法
写了一个小脚本,执行的时候报错: Traceback (most recent call last): File "F:/test/qrcode.py", line 109, in ...
- AttributeError: 'module' object has no attribute 'TornadoAsyncNotifier'
/*************************************************************************** * AttributeError: 'modu ...
- AttributeError: 'module' object has no attribute 'Thread'
$ python thread.py starting at: 2015-08-05 00:24:24Traceback (most recent call last): File "th ...
- AttributeError: module 'enum' has no attribute 'IntFlag'
Mac PyCharm新建以Python3.6.1为解释器的Django项目的时候出现以下错误提示: AttributeError: module 'enum' has no attribute 'I ...
- 【问题解决方案】AttributeError: module 'pygal' has no attribute 'Worldmap'
<Python编程:从入门到实践>- 16章-16.2.5制作世界地图 import pygal 后报如标题的error 参考CSDN 解决:AttributeError: module ...
- 安装pandas报错(AttributeError: 'module' object has no attribute 'main')
在pycharm中安装pandas出现报错:AttributeError: 'module' object has no attribute 'main', 刚开始以为是pip的版本太旧了,于是乎将其 ...
- AttributeError: 'module' object has no attribute 'enableTrace'
Traceback (most recent call last): File "Long-lived-connection.py", line 29, in <module ...
随机推荐
- CSS3学习笔记(1)—淡入的文字
今天有空把前几天学的东西发一下,都是一些简单的东西,但是千里之行始于足下,我虽然走的慢,但是未停下前进的脚步, 下来看下我做的“淡入的文字”最终动态效果: 上面这个动画效果制作的过程是: (1)先自定 ...
- ansible 自动ssh
http://szgb2016.blog.51cto.com/340201/1669731 安装 yum -y install ansible expect 生成key,ssh-keygen -t r ...
- linux命令行快捷键记录
摘自: http://www.cnblogs.com/webzhangnan/p/3221410.html [移动光标] Ctrl+A 标移到行首.它在多数文本编辑器和 Mozilla 的 URL 字 ...
- js日期的初始化的格式
js在初始化日期对象时,如果有传入日期.则格式有兼容性问题: //下面的写法在谷歌下没有问题,在火狐和ie下有问题var time = new Date('2014-11-27 00:00:00'); ...
- C#中XML解析的增加修改和删除
01添加xml节点 private void AddXml(string image, string title) { XmlDocument xmlDoc = n ...
- Rsync+Inotify同步
rsync服务安装与<rsync+sersync同步>环境一样! 安装inotify-tools 在源服务器10.10.2.191上操作: 1.查看服务器内核是否支持inotify ll ...
- C语言中数组做函数参数的问题
数组做函数参数,会退化成为一个指针变量.因此在进行数组参数传递的同时,需要传递一个数组长度的参数变量. 数组长度可以通过sizeof(arr)/siezof(arr[0])来得到.关于这个sizeof ...
- [ZJOI 2007] 捉迷藏
[题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=1095 [算法] 首先建出点分树,然后每一个点开两个堆.“第一个堆记录子树中所有节点到 ...
- 万径人踪灭(FFT+manacher)
传送门 这题--我觉得像我这样的菜鸡选手难以想出来-- 题目要求求出一些子序列,使得其关于某个位置是对称的,而且不能是连续一段,求这样的子序列的个数.这个直接求很困难,但是我们可以先求出所有关于某个位 ...
- 屏蔽iframe中超链接
<style type="text/css"> .mask { position: absolute; width: 290px; height: 96px; z-in ...