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. HDU4848 Wow! Such Conquering! —— dfs + 剪枝

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4848 题解: 一开始读错题目.以为每个点只能访问一遍.其实只要每个点都有被访问就可以了. 首先是用弗洛 ...

  2. 转回java,项目遇到的环境相关问题记录

    fastjson解析报错,兼容java8的time包:需要升级fastjson版本到1.2.9 https://www.oschina.net/question/129411_142776     j ...

  3. LR-虚拟用户以进程和线程模式运行的区别

    进程方式和线程方式的优缺点: 如果选择按照进程方式运行, 每个用户都将启动一个mmdrv进程,多个mmdrv进程会占用大量内存及其他系统资源,这就限制了可以在任一负载生成器上运行的并发用户数的数量,因 ...

  4. Telnet连接远程服务器

    使用Telnet远程连接服务器端 现在大多数人使用win7系统.在win7系统中默认已经安装好了telnet服务,我们只需要从服务中将其打开即可, 步骤在首先打开控制面板-->卸载程序--> ...

  5. Xamarin.Forms初始

    前言 Xamarin.Forms 为 .NET 开发人员提供一个完整的跨平台 UI 工具包. 在 Visual Studio 中使用 C# 生成完全本机的 Android.iOS 和通用 Window ...

  6. js Date 函数方法及日期计算

    js Date 函数方法 var myDate = new Date(); myDate.getYear(); //获取当前年份(2位) myDate.getFullYear(); //获取完整的年份 ...

  7. v-for指令用法二

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8&quo ...

  8. 深入攻克c语言--day04

    1.将包含字符数字的字符串分开,使得分开后的字符串前一部分是数字后一部分是字母.例 如“h1ell2o3” ->”123hello” #include<stdio.h> #inclu ...

  9. mysql:mysql安装及一些配置和图形界面介绍

    关于mysql,我使用的不多,这次记录是在学习一位大牛的demo的契机下完成的.包括前面记录到的sqlserver的一些知识点,也是在新的项目组中协助时候学习记录的.希望通过记录加深印象和帮助后来者. ...

  10. ECMAScript 6 &ECMAScript 5(在线手册)

    https://www.w3.org/html/ig/zh/wiki/ES5#.E8.A1.A8.E8.BE.BE.E5.BC.8F      ECMAScript 5(在线手册) http://es ...