B
B
Beko962021-02-15 20:00:56
Python
Beko96, 2021-02-15 20:00:56

Error when sending a file of type (document) Python telebot module, what to do?

Why is the file I am sending (book in fb2 format) not being sent?
And it gives an error that the variable in which I wrote this file is empty

import telebot

TOKEN = '---'
bot = telebot.TeleBot(TOKEN)

f = open(r"C:\Users\Beko\Desktop\Новая папка\Как изобрести все!.fb2","rb")

bot.send_document(мой id,f )

f.close()

bot.polling()


Error below:
telebot.apihelper.ApiTelegramException: A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: file must be non-empty <-(especially this moment please )

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lenskii, 2021-02-15
@Milovenskii

So he does not see the file, place the file in the folder with the bot and indicate the absolute path to it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question