Synchronous shutil.copyfile()

Discussion in 'Python' started by Hugo Ferreira, Jan 30, 2007.

  1. Hi there,

    I have a problem. I'm using calling shutil.copyfile() followed by
    open(). The thing is that most of the times open() is called before
    the actual file is copied. I don't have this problem when doing a
    step-by-step debug, since I give enough time for the OS to copy the
    file, but at run-time, it throws an exception.

    Is there anyway to force a sync copy of the file (make python wait for
    the completion)?

    Thanks in advance!

    Hugo Ferreira
    Hugo Ferreira, Jan 30, 2007
    #1
    1. Advertising

  2. Hugo Ferreira <> wrote:
    > I have a problem. I'm using calling shutil.copyfile() followed by
    > open(). The thing is that most of the times open() is called before
    > the actual file is copied. I don't have this problem when doing a
    > step-by-step debug, since I give enough time for the OS to copy the
    > file, but at run-time, it throws an exception.
    >
    > Is there anyway to force a sync copy of the file (make python wait for
    > the completion)?


    shutil.copyfile() closes both files before it returns, so I suspect
    this is an OS-level bug.

    The most likely culprits are buggy network filesystems and buggy
    on-access virus scanners.

    -M-
    Matthew Woodcraft, Jan 30, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jean-Paul Calderone

    Re: Synchronous shutil.copyfile()

    Jean-Paul Calderone, Jan 30, 2007, in forum: Python
    Replies:
    0
    Views:
    578
    Jean-Paul Calderone
    Jan 30, 2007
  2. Ahmed, Shakir

    permission denied in shutil.copyfile

    Ahmed, Shakir, Jul 13, 2007, in forum: Python
    Replies:
    0
    Views:
    557
    Ahmed, Shakir
    Jul 13, 2007
  3. Ahmed, Shakir

    shutil.copyfile problem for GIS data

    Ahmed, Shakir, Jul 16, 2007, in forum: Python
    Replies:
    1
    Views:
    442
    Larry Bates
    Jul 18, 2007
  4. Fletcher Johnson

    Why is the shutil module called shutil?

    Fletcher Johnson, Sep 24, 2011, in forum: Python
    Replies:
    11
    Views:
    846
    alex23
    Sep 26, 2011
  5. Rob Schneider

    shutil.copyfile is incomplete (truncated)

    Rob Schneider, Apr 11, 2013, in forum: Python
    Replies:
    31
    Views:
    424
    Chris Angelico
    Apr 13, 2013
Loading...

Share This Page