Answer the question
In order to leave comments, you need to log in
[Python Telegram Bot] How to handle location(latitude,longitude) values?
@bot.message_handler(commands=["geo"])
def geo(message):
keyboard = types.ReplyKeyboardMarkup(row_width=1, resize_keyboard=True)
button_geo = types.KeyboardButton(text="Отправить местоположение",
request_location=True)
keyboard.add(button_geo)
print(message.location.latitude)
>> AttributeError: 'NoneType' object has no attribute 'latitude'
print(message.location)
>>None
"location":{"latitude":xx.xxxxxx,"longitude":yy.yyyyyy}}}]}
Answer the question
In order to leave comments, you need to log in
Isn't message equal to location ?
then message.latitude will return a value? Or did I misunderstand?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question