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 ...
随机推荐
- Java8初体验(1):lambda表达式语法
原文出处: 一冰_天锦 本文主要记录自己学习Java8的历程,方便大家一起探讨和自己的备忘.因为本人也是刚刚开始学习Java8,所以文中肯定有错误和理解偏差的地方,希望大家帮忙指出,我会持续修改和优化 ...
- python字典无序?有序?
默认情况下Python的字典输出顺序是按照键的创建顺序. 字典的无序是指,不能人为重新排序.比如说你按键值1,2,3,4的顺序创建的字典,只能由解析器按创建顺序,还是1,2,3,4的输出.你无法控制它 ...
- android实现文字渐变效果和歌词进度的效果
要用TextView使用渐变色,那我们就必须要了解LinearGradient(线性渐变)的用法. LinearGradient的参数解释 LinearGradient也称作线性渲染,LinearGr ...
- Linux下C语音实现socket发送和接收的小程序
1.什么是socket套接字 socket其实就是计算机通信的端口,可以实现两个计算机之间的通信的一个接口,应用程序在网络上传输就是通过这个借口实现. socket分为三种类型: 字节流套接字(Str ...
- Can't locate Log/Dispatch.pm in @INC /Makefile out-of-date with respect to Makefile.PL
mha check的时候报错问题解决: # masterha_check_ssh --conf=/data/mha/app1.cnf Can't locate Log/Dispatch.pm in ...
- web集群时代
随着业务的不断增加,我们的单台服务器承受不住需求,那么我们就需要对此进行伸缩,有两种维度,一种是纵向的也就是增大该台服务器的硬件,再者就是加新服务器与之前的机器组成集群对外提供服务,我们都知道前者是有 ...
- EntityFrameWork Parameter '@columnType' must be defined.
环境: EntityFrameWork CodeFirst+MySql 今天在提交一个外键字段的修改时报“Parameter '@columnType' must be defined.” goog ...
- stdout引发的curl 302跳转 crash
重现步骤: 0.开发环境:Windows 7 SP1 64bit, VS2008 SP1 1.进程中修改了stdout这个句柄的值:调用了prinft和cout都会修改stdout,TRACE不会修改 ...
- const_cast标准转换运算符
#include <iostream> using namespace std; class A { public: A() { a=; } public: int a; }; void ...
- Andriod开发 --插件安装、环境配置、问题集锦
1.用Eclipse搭建Android开发环境和创建第一个Android项目(Windows平台) 链接阅读http://www.cnblogs.com/allenzheng/archive/2012 ...