#NEWLINE# def rm_rf( path ) : #NEWLINE# #INDENT# '\n    Platform-independent recursive delete. Includes code from\n    http://stackoverflow.com/a/2656405\n    ' #NEWLINE# def _onerror( func , path , exc_info ) : #NEWLINE# #INDENT# '\n        Error handler for `shutil.rmtree`.\n\n        If the error is due to an access error (read only file)\n        it attempts to add write permission and then retries.\n\n        If the error is for another reason it re-raises the error.\n\n        Usage : `shutil.rmtree(path, onerror=onerror)`\n        ' #NEWLINE# if ( is_windows ( ) and ( not os . access ( path , os . W_OK ) ) ) : #NEWLINE# #INDENT# os . chmod ( path , stat . S_IWUSR ) #NEWLINE# func ( path ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# #UNINDENT# shutil . rmtree ( _onerror , onerror = _onerror )