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. VK Cup 2015 - Round 2 E. Correcting Mistakes —— 字符串

    题目链接:http://codeforces.com/contest/533/problem/E E. Correcting Mistakes time limit per test 2 second ...

  2. I.MX6 Surfaceflinger 机制

    /**************************************************************************** * I.MX6 Surfaceflinger ...

  3. 【CQ18高一暑假前挑战赛1】标程

    [A] #include<bits/stdc++.h> using namespace std; #define ll long long ll qpow(ll a,ll x,ll Mod ...

  4. JAVA 需要理解的重点 二

    1.常用设计模式 单例模式:懒汉式.饿汉式.双重校验锁.静态加载,内部类加载.枚举类加载.保证一个类仅有一个实例,并提供一个访问它的全局访问点. 代理模式:动态代理和静态代理,什么时候使用动态代理. ...

  5. 19.break和continue

    break;语句: 1.可以在switch语句中,结束分支语句: 2.break:语句可以出现在单循环当中,默认情况下结束距离他最近的一个循环. 3.break 后面跟一个循环的名字可以结束你指定的这 ...

  6. salt api

    #!/usr/bin/env python # -*- coding:utf8 -*- # __author__ = '北方姆Q' import requests import json from d ...

  7. js事件触发器fireEvent和dispatchEvent

    转自:https://www.cnblogs.com/tiger95/p/6962059.html 事件触发器就是用来触发某个元素下的某个事件,IE下fireEvent方法,高级浏览器(chrome, ...

  8. 查看Spring源码的方法

    来自为知笔记(Wiz)

  9. 通过url在两个页面之间传值

    今天开发遇到一个需要通过url传值才能解决的问题,就查了一下资料 一下是整理的结果: 假如需要把a页面的值传到b页面 a页面代码 <script type="text/javascri ...

  10. [CVE-2014-3704]Drupal 7.31 SQL注入漏洞分析与复现

    记录下自己的复现思路 漏洞影响: Drupal 7.31 Drupal是一个开源内容管理平台,为数百万个网站和应用程序提供支持. 0x01漏洞复现 复现环境: 1) Apache2.4 2) Php ...