You are here: Home Blog OSError while installing Django with buildout and djangorecipe

OSError while installing Django with buildout and djangorecipe

by Dan Fairs last modified Jan 18, 2010 05:28 PM
A corrupted Django tarball can cause mysterious errors from djangorecipe.

Sometimes, I see the following error when trying to run a Django buildout:

File "/Users/dan/.eggs/djangorecipe-0.20-py2.6.egg/djangorecipe/recipe.py", line 271, in install_release
    os.listdir(extraction_dir)[0]
OSError: [Errno 2] No such file or directory: '/Users/dan/.downloads/django-archive'

After a bit of poking around, I found that this is to do with a corrupted Django tarball. In my case, this is usually because I've interrupted a download with Ctrl-C. Unfortunately it seems that the tarfile module in the Python standard library (at least as invoked by setuptools) treats broken a tar.gz files as an empty archive, without throwing an exception. Since there's no exception, djangorecipe assumes everything was uncompressed without problems, and is therefore rather surprised when the unpacked Django package isn't where it expected it to be.

The short term solution is to delete the bad Django archive from your download cache. This will likely be a 'downloads' directory in your buildout, or you may have a global one (as I do). When you next run buildout, the tarball will be freshly downloaded.

When I get a moment I'll see if I can modify djangorecipe to notice this condition and not proceed with the build.

Filed under: , ,
Adomas Paltanavičius
Adomas Paltanavičius says:
Sep 30, 2010 04:15 PM
Had this happen to me once, just after 1.1.1 security release. My first reaction was that something was wrong with 1.1.1 tarballs, something that proved wrong after... checking the download cache.
Add comment

You can add a comment by filling out the form below. Plain text formatting.