Only try and delete if exists!

This commit is contained in:
Anthony Plunkett 2016-02-09 17:36:22 -04:00
parent f06f96cc3a
commit 6db7d177ae
1 changed files with 7 additions and 9 deletions

View File

@ -33,6 +33,12 @@ def find_location():
return None, None
return install_dir, os.path.join(install_dir, LIB)
def deletion_error(func, path, excinfo):
print 'Problem deleting {}'.format(path)
print 'Please try and delete {} manually'.format(path)
print 'Aborted!'
sys.exit()
def fail(message):
print 'Error: %s' % message
sys.exit(1)
@ -98,20 +104,12 @@ def main():
).lower().strip()
if input in ('', 'y'):
shutil.rmtree(get_location())
break
elif input == 'n':
print 'Aborted!'
sys.exit()
def report_error(func, path, excinfo):
print('Problem deleting {}, {}, {}'.format(func, path, excinfo))
print('Please try and delete {} manually'.format(get_location())
print('Aborted!')
sys.exit()
shutil.rmtree(get_location(), onerror=report_error)
print ' Installing at: %s' % install_dir
while 1:
input = raw_input('Continue? [Yn] ').lower().strip()