* morituri/common/accurip.py:

The AccuRip cache dir could exist without the file; handle that
	  case.
This commit is contained in:
Thomas Vander Stichele
2010-01-31 15:54:12 +00:00
parent 26ecd42c2f
commit ee186a0d30
2 changed files with 15 additions and 1 deletions

View File

@@ -1,3 +1,9 @@
2010-01-31 Thomas Vander Stichele <thomas at apestaart dot org>
* morituri/common/accurip.py:
The AccuRip cache dir could exist without the file; handle that
case.
2009-12-28 Thomas Vander Stichele <thomas at apestaart dot org>
* morituri/common/program.py:

View File

@@ -20,6 +20,7 @@
# You should have received a copy of the GNU General Public License
# along with morituri. If not, see <http://www.gnu.org/licenses/>.
import errno
import os
import struct
import urlparse
@@ -75,7 +76,14 @@ class AccuCache(log.Loggable):
def _cache(self, url, data):
path = self._getPath(url)
os.makedirs(os.path.dirname(path))
try:
os.makedirs(os.path.dirname(path))
except OSError, e:
self.debug('Could not make dir %s: %r' % (
path, log.getExceptionMessage(e)))
if e.errno != errno.EEXIST:
raise
handle = open(path, 'wb')
handle.write(data)
handle.close()