dir_util.copy_tree call

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Phoe6

    #1

    dir_util.copy_tree call

    Hi all.
    I am using IDLE when I am on the python shell, I do:
    [color=blue][color=green][color=darkred]
    >>>import os
    >>>os.mkdir('ne wdir')
    >>>from dirutils import dir_util
    >>>#copy a big directory tree
    >>>dir_util.cop y_tree('big_dir ectory','newdir ')[/color][/color][/color]

    This works properly, but I find a huge Resource Comsumption of my PC.
    100% of CPU and Memory.

    Now, when I put the same steps a python file and then Run Module:

    copy_tree is failing with

    Traceback (most recent call last):
    File "C:\builds\Auto mateBuild\pyBui ldAutomate.py", line 19, in ?
    dir_util.copy_t ree('Py4CliLinu x','CliAuto-lin')
    File "C:\Python24\Li b\distutils\dir _util.py", line 172, in copy_tree
    dry_run=dry_run ))
    File "C:\Python24\Li b\distutils\dir _util.py", line 175, in copy_tree
    preserve_times, update, dry_run=dry_run )
    File "C:\Python24\Li b\distutils\fil e_util.py", line 165, in copy_file
    _copy_file_cont ents(src, dst)
    File "C:\Python24\Li b\distutils\fil e_util.py", line 47, in
    _copy_file_cont ents
    fdst = open(dst, 'wb')
    IOError: [Errno 2] No such file or directory: 'big_directory/some/path'
    # modified the actual names.

    - What I am doing is trying to copy a directory tree to a another
    directory tree.
    - shutil.copytree does not help as it requires the dst directory to be
    absent.

    Any help?

    Thanks!
    Senthil


    --


  • Dave Mandelin

    #2
    Re: dir_util.copy_t ree call

    In IDLE, by default the working directory for the interactive prompt is
    the working directory for IDLE itself. The working directory for
    running a module is the directory the module is stored in. In your
    script, use absolute paths or set the

    --
    Want to play tabletop RPGs over the internet?
    Check out Koboldsoft RPZen: http://www.koboldsoft.comcwd.

    Comment

    Working...