Strange exceptions raised by os.renames and shutil.copytree

drifty at my-deja.com drifty at my-deja.com
Sat Jan 13 18:23:40 EST 2001


In article <3A60CCF0.445FCEC4 at san.rr.com>,
  Darren New <dnew at san.rr.com> wrote:
> > The second way I tried was using os.renames(), but that raised OSError
> > [errno 13].  Now I realize that normally this would be resolved by
> > making sure that all files in the directory being renamed were closed,
> > but the problem is that I don't have any files open from the directory.
> >  The only thing the program has done to the source directory up to that
> > point is os.listdir() and os.path.isdir() on the directory.
>
> Just a guess, but make sure your current directory isn't the directory
> you're trying to rename before you try renaming it. os.path.listdir()
might
> leave you cwd set to what it listed or something?
>
> --
> Darren New / Senior MTS & Free Radical / Invisible Worlds Inc.
> San Diego, CA, USA (PST).  Cryptokeys on demand.
>    Crunching tiger, hidden dragon
>





os.listdir() only visits the directory; it does not pwd into it; or if
it does it comes right back.  And I do not listdir() into the directory;
I listdir() the directory above it.

-Brett


Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list