From 192dbbc2a7b5485adb458d737cc5b0e06765fb46 Mon Sep 17 00:00:00 2001 From: manetta Date: Mon, 1 Feb 2021 11:33:29 +0100 Subject: [PATCH] updating the download path --- LogBot/logbot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/LogBot/logbot.py b/LogBot/logbot.py index c41c6cb..0a1a896 100644 --- a/LogBot/logbot.py +++ b/LogBot/logbot.py @@ -53,12 +53,12 @@ def download(message): parsed_url = urlparse(message.url) filename = os.path.basename(parsed_url.path).replace(' ','_').replace('%20','_') # safe url's print('as the file: ', filename) - if not os.path.isdir(f'{ message.room }/{ media_type }'): - os.mkdir(f'{ message.room }/{ media_type }') - with open(f'{ message.room }/{ media_type }/{ filename }', 'wb') as media_file: + if not os.path.isdir(f'{ output }/{ message.room }/{ media_type }'): + os.mkdir(f'{ output }/{ message.room }/{ media_type }') + with open(f'{ output }/{ message.room }/{ media_type }/{ filename }', 'wb') as media_file: media_file.write(data) media_file.close() - + # define media_post media_path = f'{ media_type }/{ filename }' if message.url.lower().endswith(('.jpg','jpeg','png','.gif','.bmp','.svg','eps')):