mirror of
https://github.com/KevinMidboe/bulk-downloader-for-reddit.git
synced 2025-10-29 17:40:15 +00:00
Use else in try blocks
This commit is contained in:
@@ -61,13 +61,14 @@ def getFile(fileDir,tempDir,imageURL,indent=0):
|
|||||||
tempDir,
|
tempDir,
|
||||||
reporthook=dlProgress)
|
reporthook=dlProgress)
|
||||||
os.rename(tempDir,fileDir)
|
os.rename(tempDir,fileDir)
|
||||||
print(" "*indent+"Downloaded"+" "*10)
|
|
||||||
break
|
|
||||||
except ConnectionResetError as exception:
|
except ConnectionResetError as exception:
|
||||||
print(" "*indent + str(exception))
|
print(" "*indent + str(exception))
|
||||||
print(" "*indent + "Trying again\n")
|
print(" "*indent + "Trying again\n")
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
raise FileNameTooLong
|
raise FileNameTooLong
|
||||||
|
else:
|
||||||
|
print(" "*indent+"Downloaded"+" "*10)
|
||||||
|
break
|
||||||
else:
|
else:
|
||||||
raise FileAlreadyExistsError
|
raise FileAlreadyExistsError
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user