Answer the question
In order to leave comments, you need to log in
Error FileNotFoundError: [Errno 2] No such file or directory. What's wrong?
Hello.
I am writing a telegram bot. I want to have a sticker and text when executing the /start command.
from pyexpat.errors import messages
import telebot
from telebot import types
mybot = telebot.TeleBot("мой токен")
@mybot.message_handler(commands=['start'])
def messages(message):
sti = open('dir/cupwin.webp')
mybot.send_sticker(message.chat.id, sti)
Answer the question
In order to leave comments, you need to log in
The file does not appear to be in the folder.
And another mistake, it's better this way
sti = open('dir/cupwin.webp', 'rb')
Not fully understood pycharm + added a second argument and it worked.
Thank you!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question