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'的更多相关文章

  1. python中引入包的时候报错AttributeError: module 'sys' has no attribute 'setdefaultencoding'解决方法?

    python中引入包的时候报错:import unittestimport smtplibimport timeimport osimport sysimp.reload(sys)sys.setdef ...

  2. Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法

    最近在编写Python脚本过程中遇到一个问题比较奇怪:Python脚本完全正常没问题,但执行总报错"AttributeError: 'module' object has no attrib ...

  3. attributeError:'module' object has no attribute ** 解决办法

    写了一个小脚本,执行的时候报错: Traceback (most recent call last): File "F:/test/qrcode.py", line 109, in ...

  4. AttributeError: 'module' object has no attribute 'TornadoAsyncNotifier'

    /*************************************************************************** * AttributeError: 'modu ...

  5. AttributeError: 'module' object has no attribute 'Thread'

    $ python thread.py starting at: 2015-08-05 00:24:24Traceback (most recent call last):  File "th ...

  6. AttributeError: module 'enum' has no attribute 'IntFlag'

    Mac PyCharm新建以Python3.6.1为解释器的Django项目的时候出现以下错误提示: AttributeError: module 'enum' has no attribute 'I ...

  7. 【问题解决方案】AttributeError: module 'pygal' has no attribute 'Worldmap'

    <Python编程:从入门到实践>- 16章-16.2.5制作世界地图 import pygal 后报如标题的error 参考CSDN 解决:AttributeError: module ...

  8. 安装pandas报错(AttributeError: 'module' object has no attribute 'main')

    在pycharm中安装pandas出现报错:AttributeError: 'module' object has no attribute 'main', 刚开始以为是pip的版本太旧了,于是乎将其 ...

  9. AttributeError: 'module' object has no attribute 'enableTrace'

    Traceback (most recent call last): File "Long-lived-connection.py", line 29, in <module ...

随机推荐

  1. POj 3253 Fence Repair(修农场栅栏,锯木板)(小根堆 + 哈弗曼建树得最小权值思想 )

    Fence Repair Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 28359   Accepted: 9213 Des ...

  2. HDU2896 病毒侵袭 —— AC自动机

    题目链接:https://vjudge.net/problem/HDU-2896 病毒侵袭 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit ...

  3. servlet理论学习

    servlet是和凭条无关的服务器端的组件,它运行在servlet容器中,servlet容器负责servlet和客户的通信以及调用servlet方法.servlet和客户的通信是采用“请求和响应的模式 ...

  4. TX2 刷机过程

    1.拿到板子,上电 (1)输入 ls (2)进入NVIDIA-INSTALLER/ (3)再sudo ./installer.sh 账户和密码都是:nvidia (4)sudo reboot 参考博客 ...

  5. lsyncd实时同步搭建指南——取代rsync+inotify

    1. 几大实时同步工具比较 1.1 inotify + rsync 最近一直在寻求生产服务服务器上的同步替代方案,原先使用的是inotify + rsync,但随着文件数量的增大到100W+,目录下的 ...

  6. kafka之三:kafka java 生产消费程序demo示例

    kafka是吞吐量巨大的一个消息系统,它是用scala写的,和普通的消息的生产消费还有所不同,写了个demo程序供大家参考.kafka的安装请参考官方文档. 首先我们需要新建一个maven项目,然后在 ...

  7. A-Z,a-z,0-9的unicode编码表

    1.转自:https://blog.csdn.net/fedawn/article/details/7307993 A-Z 的 Unicode 字符编码表     十进制  十六进制 1.“A”的 U ...

  8. 【219】◀▶ IDL 数学函数说明

    参考:Math - Miscellaneous Routines参考:Math - Statistical Tools Routines 01   ABS 绝对值. 02   SQRT 平方根. 03 ...

  9. hdu-2563

    统计问题 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submis ...

  10. C++ TUTORIAL - MEMORY ALLOCATION - 2016

    http://www.bogotobogo.com/cplusplus/memoryallocation.php Variables and Memory Variables represent st ...