Skip to content

Commit

Permalink
updated to open the destination file inside of a try/except block
Browse files Browse the repository at this point in the history
  • Loading branch information
willmadison committed May 31, 2017
1 parent 4bf81a4 commit a810033
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions blockstack_client/backend/drivers/sia.py
Expand Up @@ -227,19 +227,25 @@ def download(key):

contents = None

downloaded = open(destination)
downloaded = None

try:
os.remove(destination)
downloaded = open(destination)
except Exception as e:
log.exception(e)

try:
contents = downloaded.read()
downloaded.close()
os.remove(destination)
except Exception as e:
log.exception(e)

if downloaded is not None:
try:
contents = downloaded.read()
downloaded.close()
except Exception as e:
log.exception(e)

return contents
except Exception as e:
log.exception(e)
Expand Down

0 comments on commit a810033

Please sign in to comment.