JakobLichterfeld / TeslaMate-Telegram-Bot

A telegram bot which sends a message if an update for your Tesla is available (use TeslaMate MQTT)
MIT License
27 stars 4 forks source link

UnboundLocalError: cannot access local variable 'message_text' where it is not associated with a value #34

Closed JakobLichterfeld closed 8 months ago

JakobLichterfeld commented 8 months ago

v0.7.3 runs on test system, fails on production with:

teslamatetelegrambot | Traceback (most recent call last): teslamatetelegrambot | File "/app/./src/teslamate_telegram_bot.py", line 227, in teslamatetelegrambot | asyncio.run(main()) teslamatetelegrambot | File "/usr/local/lib/python3.12/asyncio/runners.py", line 194, in run teslamatetelegrambot | return runner.run(main) teslamatetelegrambot | ^^^^^^^^^^^^^^^^ teslamatetelegrambot | File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run teslamatetelegrambot | return self._loop.run_until_complete(task) teslamatetelegrambot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ teslamatetelegrambot | File "/usr/local/lib/python3.12/asyncio/base_events.py", line 685, in run_until_complete teslamatetelegrambot | return future.result() teslamatetelegrambot | ^^^^^^^^^^^^^^^ teslamatetelegrambot | File "/app/./src/teslamate_telegram_bot.py", line 205, in main teslamatetelegrambot | await check_state_and_send_messages(bot, chat_id) teslamatetelegrambot | File "/app/./src/teslamate_telegram_bot.py", line 172, in check_state_and_send_messages teslamatetelegrambot | await send_telegram_message_to_chat_id(bot, chat_id, message_text) teslamatetelegrambot | ^^^^^^^^^^^^ teslamatetelegrambot | UnboundLocalError: cannot access local variable 'message_text' where it is not associated with a value teslamatetelegrambot exited with code 0

JakobLichterfeld commented 8 months ago

solved by https://github.com/JakobLichterfeld/TeslaMate-Telegram-Bot/commit/5d6267fc952a496417663f741e8cdbccfdee64b7