[Tilecache] make dir error

Fredrik Lundh fredrik at pythonware.com
Thu Apr 10 11:32:33 EDT 2008


>  Agreed. I keep thinking I've already done this, but never get around to
>  it. I'll take a patch...

The patch below should work, I think (only briefly tested).

</F>

--- Disk.py.bak Thu Apr 10 17:27:09 2008
+++ Disk.py     Thu Apr 10 17:20:35 2008
@@ -1,7 +1,7 @@
 # BSD Licensed, Copyright (c) 2006-2007 MetaCarta, Inc.

 from TileCache.Cache import Cache
-import sys, os, time
+import sys, os, time, errno

 class Disk (Cache):
    def __init__ (self, base = None, umask = '002', **kwargs):
@@ -21,7 +21,11 @@

    def makedirs(self, path):
        old_umask = os.umask(self.umask)
-        os.makedirs(path)
+        try:
+            os.makedirs(path)
+        except OSError, e:
+            if e.errno != errno.EEXIST:
+                raise
        os.umask(old_umask)

    def access(self, path, type='read'):



More information about the Tilecache mailing list