Skip to content

Commit

Permalink
Use else in try blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
aliparlakci committed Jul 24, 2018
1 parent 7671189 commit d9586f9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit d9586f9

Please sign in to comment.