Good day! Faced a problem when Django can not see the path to the picture, which is signed in Russian. If the English / numbers, then everything works fine.
Here is a piece of code:
if callback_data.find('L') != -1: mes = str(user.fish.NameFishRus) bot.send_message(chat_id, mes) try: photo = open('/home/fishbot/fishbot/' + user.fish.Fish_photo.url, 'rb') bot.send_photo(chat_id, photo) except: pass mes = 'Введите длину в сантиметрах:' bot.send_message(chat_id, mes) In models, the usual model ImageField I tried this method:
import urllib.parse if callback_data.find('L') != -1: mes = str(user.fish.NameFishRus) bot.send_message(chat_id, mes) try: photo = open(urllib.parse.quote_plus('/home/fishbot/fishbot/' + user.fish.Fish_photo.url, 'rb')) bot.send_photo(chat_id, photo) except: pass mes = 'Введите длину в сантиметрах:' bot.send_message(chat_id, mes) I use Django 1.11 Please help :) Thank you!