AttributeError: 'LabeledPrice' object has no attribute 'to_dict'

Viewed 215

I want to add payment for my telegram bot(pyTelegramBotAPI). But when I use payments_example.py from GitHub - it gives exception:
AttributeError: 'LabeledPrice' object has no attribute 'to_dict'.

Can somebody help me with this?

shipping_options = [
    ShippingOption(id='instant', title='WorldWide Teleporter').add_price(LabeledPrice('Teleporter', 1000))
]


@bot.shipping_query_handler(func=lambda query: True)
def shipping(shipping_query):
    print(shipping_query)
    bot.answer_shipping_query(
        shipping_query.id,
        ok=True,
        shipping_options=shipping_options,
        error_message='Oh, seems like our Dog couriers are having a lunch right now. Try again later!'
    )
1 Answers

I faced that problem just now with python-telegram-bot version 13.5, while downgrading to 13.4.1 fixed the issue temporarily (via pip3 install 'python-telegram-bot==13.4.1').

Happened on Ubuntu 20.04 and Python 3.8.5.

Related