This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Module: shutil will not import when writen in the text editor but will in the python shell
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: dj_law, r.david.murray
Priority: normal Keywords:

Created on 2012-12-18 01:54 by dj_law, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
dropbox dropper.py dj_law, 2012-12-18 01:54 has the import shutil thing in
Messages (3)
msg177674 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-12-18 02:06
It works fine for me.  Are you on windows by any chance?  I suspect you should take this to python-list for help, but you could paste the traceback you are getting if you still think it is a bug in Python.
msg177678 - (view) Author: luke wood (dj_law) Date: 2012-12-18 07:34
ok i dont really know what python list is. i googled it but it just came up with the documentation.

Traceback (most recent call last):
  File "C:\Users\luke\Documents\Python Code\dropbox dropper.py", line 1, in <module>
    import shutil
  File "C:\Python33\lib\shutil.py", line 14, in <module>
    import tarfile
  File "C:\Python33\lib\tarfile.py", line 48, in <module>
    import copy
  File "C:\Users\luke\Documents\Python Code\copy.py", line 4, in <module>
    shutil.copy2(source, destination)
AttributeError: 'module' object has no attribute 'copy2'
msg177687 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-12-18 12:30
You have a 'copy.py' module in your python path, as is evidenced by the filename in your traceback, which tarfile is importing instead of the real copy module, and your copy.py is therefore trying to use shutil before it is completely imported, thus the error.  So this is indeed a local problem on your machine.

python-list is a mailing list where there are a lot of python users, many of whom will be willing to help you sort this out if you need more help.  Go to mail.python.org for a list of lists and signup instructions.
History
Date User Action Args
2022-04-11 14:57:39adminsetgithub: 60912
2012-12-18 12:30:21r.david.murraysetstatus: open -> closed
resolution: works for me -> not a bug
messages: + msg177687
2012-12-18 07:34:28dj_lawsetstatus: pending -> open

messages: + msg177678
2012-12-18 02:06:41r.david.murraysetstatus: open -> pending

nosy: + r.david.murray
messages: + msg177674

resolution: works for me
stage: resolved
2012-12-18 01:54:01dj_lawcreate