Hello people this is a part of my code, that gets

and save user sent photo and names it by chat_id.

👇🏻👇🏻👇🏻👇🏻👇🏻
user_photo = update.message.photo[-1].get_file()
user_photo.download(f'''{update.message.chat_id} - front.jpg''')
👆🏼👆🏼👆🏼👆🏼👆🏼

the problem is that i need the photo to be saved in:
project folder/another folder

but it automatically saves in project folder
how can i change the directory?!
tnx

3 ответов

19 просмотров

Hi, which library are you using? I assume that you need to pass the download location to the download() method. So I guess this would work: user_photo.download(f'''/path/to/directory/{update.message.chat_id} - front.jpg''')

user_photo.download(f'''another-directory/{update.message.chat_id} - front.jpg''')

صادق- Автор вопроса
Andrew Kirilenko
user_photo.download(f'''another-directory/{update....

No such file or directory: 'another_folder/226541220 - front.jpg'

Похожие вопросы

Карта сайта