1
0
Fork 0
mirror of synced 2024-06-26 10:00:20 +12:00

Use else in try blocks

This commit is contained in:
Ali Parlakci 2018-07-24 22:11:12 +03:00
parent 76711892a2
commit d9586f99b8

View file

@ -61,13 +61,14 @@ def getFile(fileDir,tempDir,imageURL,indent=0):
tempDir,
reporthook=dlProgress)
os.rename(tempDir,fileDir)
print(" "*indent+"Downloaded"+" "*10)
break
except ConnectionResetError as exception:
print(" "*indent + str(exception))
print(" "*indent + "Trying again\n")
except FileNotFoundError:
raise FileNameTooLong
else:
print(" "*indent+"Downloaded"+" "*10)
break
else:
raise FileAlreadyExistsError