Last active
March 28, 2016 00:50
-
-
Save johnrichardrinehart/29aaae9be1c0fcdb973b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if not os.path.exists(os.path.dirname(filename)): | |
try: | |
os.makedirs(os.path.dirname(filename)) | |
except OSError as exc: # protects against race conds | |
if exc.errno != errno.EEXIST: | |
printToLog("Failed to make the directory!",1) | |
raise | |
with open(filename,"w") as f: | |
for chunk in res.iter_content(2**20): | |
f.write(chunk) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment