#NEWLINE# def download_md5( uri , dest ) : #NEWLINE# #INDENT# '\n    downloads file from uri to file dest\n    ' #NEWLINE# dirname = os . path . dirname ( dest ) #NEWLINE# if len ( dirname ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# os . makedirs ( dirname ) #NEWLINE# #UNINDENT# except OSError as e : #NEWLINE# #INDENT# if ( e . errno != errno . EEXIST ) : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# sys . stdout . write ( ( 'Downloading %s to %s...' % ( uri , dest ) ) ) #NEWLINE# sys . stdout . flush ( ) #NEWLINE# try : #NEWLINE# #INDENT# download_with_resume ( uri , dest ) #NEWLINE# sys . stdout . write ( ' done.\n' ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# if os . path . exists ( dest ) : #NEWLINE# #INDENT# os . unlink ( dest ) #NEWLINE# #UNINDENT# sys . stdout . write ( ( ' failed (%s)!\n' % dirname ) ) #NEWLINE# raise