K
K
Kirill2021-12-18 09:10:12
Python
Kirill, 2021-12-18 09:10:12

Bug in Python bot?

I found an article on Habré:
https://habr.com/ru/post/584134/

Telegram bot that shows the weather.
I tried to write, I put all the code in main.py and got an error -

Traceback (most recent call last):
  File "C:/Users/Huawei/PycharmProjects/botweather/main.py", line 8, in <module>
    token = environ['5086285465:AAETFuhSHGa5y5Xup0gBdFPX6P05bn_F8zA']
  File "C:\Users\Huawei\AppData\Local\Programs\Python\Python38-32\lib\os.py", line 675, in __getitem__
    raise KeyError(key) from None
KeyError: '5086285465:AAETFuhSHGa5y5Xup0gBdFPX6P05bn_F8zA'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2021-12-18
@fox_12

token = environ['5086285465:AAETFuhSHGa5y5Xup0gBdFPX6P05bn_F8zA']

Here you need to specify the environment variable where the key is stored, and not the key itself...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question