fix error when trying to re-create media folder
This commit is contained in:
parent
e7ae240555
commit
c7ea1bc1c8
|
@ -118,7 +118,8 @@ def req():
|
||||||
photo_url = os.path.join(os.environ.get('MICROPUB_MEDIA_URL_PREFIX'), now.strftime("%Y/%m/%d"), str(now_ts) + ".jpg")
|
photo_url = os.path.join(os.environ.get('MICROPUB_MEDIA_URL_PREFIX'), now.strftime("%Y/%m/%d"), str(now_ts) + ".jpg")
|
||||||
|
|
||||||
# make directory if needed
|
# make directory if needed
|
||||||
os.makedirs(os.path.dirname(filename))
|
if not os.path.exists(os.path.dirname(filename)):
|
||||||
|
os.makedirs(os.path.dirname(filename))
|
||||||
|
|
||||||
with open(filename, 'wb') as f:
|
with open(filename, 'wb') as f:
|
||||||
f.write(r.content)
|
f.write(r.content)
|
||||||
|
|
Loading…
Reference in New Issue