os.rename() in _call_easy_install fails intermittently on Windows

Bug #503640 reported by Sidnei da Silva on 2010-01-06
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Buildout
Undecided
Unassigned

Bug Description

Very frequently buildout blows up during the call to os.rename() in _call_easy_install with an 'OSError: Permission Denied' on Windows.

The problematic code is:

            for d in dists:
                newloc = os.path.join(dest, os.path.basename(d.location))
                if os.path.exists(newloc):
                    if os.path.isdir(newloc):
                        shutil.rmtree(newloc)
                    else:
                        os.remove(newloc)
                os.rename(d.location, newloc)

Apparently, an anti-virus or Google Desktop Search could cause this kind of failure (the third-party application might have an open handle to one of the files). Not sure what to do other than retrying the call a couple times until it works, or using shutil.move() which is a little bit smarter about it.

Sidnei da Silva (sidnei) wrote :

Here's a full traceback showing the issue:

While:
  Installing instance.
  Getting distribution for 'kss.core==1.4.7'.

An internal error occured due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
  File "c:\src\plone\3.3\buildout-cache\eggs\zc.buildout-1.4.2-py2.4.egg\zc\buil
dout\buildout.py", line 1660, in main
    getattr(buildout, command)(args)
  File "c:\src\plone\3.3\buildout-cache\eggs\zc.buildout-1.4.2-py2.4.egg\zc\buil
dout\buildout.py", line 532, in install
    installed_files = self[part]._call(recipe.install)
  File "c:\src\plone\3.3\buildout-cache\eggs\zc.buildout-1.4.2-py2.4.egg\zc\buil
dout\buildout.py", line 1204, in _call
    return f()
  File "c:\src\plone\3.3\buildout-cache\eggs\plone.recipe.zope2instance-3.4-py2.
4.egg\plone\recipe\zope2instance\__init__.py", line 39, in install
    requirements, ws = self.egg.working_set()
  File "c:\src\plone\3.3\buildout-cache\eggs\zc.recipe.egg-1.2.2-py2.4.egg\zc\re
cipe\egg\egg.py", line 89, in working_set
    allow_hosts=self.allow_hosts,
  File "c:\src\plone\3.3\buildout-cache\eggs\zc.buildout-1.4.2-py2.4.egg\zc\buil
dout\easy_install.py", line 800, in install
    return installer.install(specs, working_set)
  File "c:\src\plone\3.3\buildout-cache\eggs\zc.buildout-1.4.2-py2.4.egg\zc\buil
dout\easy_install.py", line 670, in install
    for dist in self._get_dist(requirement, ws, self._always_unzip
  File "c:\src\plone\3.3\buildout-cache\eggs\zc.buildout-1.4.2-py2.4.egg\zc\buil
dout\easy_install.py", line 542, in _get_dist
    dists = self._call_easy_install(
  File "c:\src\plone\3.3\buildout-cache\eggs\zc.buildout-1.4.2-py2.4.egg\zc\buil
dout\easy_install.py", line 381, in _call_easy_install
    os.rename(d.location, newloc)
OSError: [Errno 13] Permission denied

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers