import_export - Added some error handling

We still want to be able to do an export if a file can't be read
This commit is contained in:
Joar Wandborg 2011-10-14 03:15:50 +02:00
parent a249b6d3a2
commit a7ca2a7211

View File

@ -215,10 +215,12 @@ def _export_media(db, args):
_log.info('Exporting {0} - {1}'.format(
entry['title'],
name))
mc_file = media_cache.get_file(path, mode='wb')
mc_file.write(
mg_globals.public_store.get_file(path, mode='rb').read())
try:
mc_file = media_cache.get_file(path, mode='wb')
mc_file.write(
mg_globals.public_store.get_file(path, mode='rb').read())
except e:
_log.error('Failed: {0}'.format(e))
_log.info('...Media exported')