CC-2805: Airtime-import is failing

- catching IOexception.
This commit is contained in:
James 2011-09-13 10:35:25 -04:00
parent ab302b46ad
commit ac7e4566c0
1 changed files with 32 additions and 29 deletions

View File

@ -31,6 +31,7 @@ api_client = apc.api_client_factory(config)
# copy or move files # copy or move files
# flag should be 'copy' or 'move' # flag should be 'copy' or 'move'
def copy_or_move_files_to(paths, dest, flag): def copy_or_move_files_to(paths, dest, flag):
try:
for path in paths: for path in paths:
if (path[0] == "/" or path[0] == "~"): if (path[0] == "/" or path[0] == "~"):
path = os.path.realpath(path) path = os.path.realpath(path)
@ -59,6 +60,8 @@ def copy_or_move_files_to(paths, dest, flag):
shutil.move(path, destfile) shutil.move(path, destfile)
else: else:
print "Cannot find file or path: %s" % path print "Cannot find file or path: %s" % path
except Exception as e:
print "Error: ", e
def format_dir_string(path): def format_dir_string(path):
if(path[-1] != '/'): if(path[-1] != '/'):
@ -294,7 +297,7 @@ except Exception, e:
if hasattr(e, 'msg'): if hasattr(e, 'msg'):
print "Error: "+e.msg print "Error: "+e.msg
else: else:
print "Error: "+e print "Error: ",e
sys.exit() sys.exit()
except SystemExit: except SystemExit:
printHelp() printHelp()