T
T
TeleQuest1232021-02-16 17:40:44
Python
TeleQuest123, 2021-02-16 17:40:44

How to specify the path to the photo on the VPS/VDS server in the telegram bot code?

The essence of the problem:

wrote a bot, it runs on a PC without problems, everything works. But, when the bot was transferred to the server, it gives an error, because it does not find the photo that it should send to the feed when the button is pressed. And all because the path to the file I have is the one that was on the PC. bot.send_photo(message.chat.id, open("C: /Users/I/PycharmProjects/Name/venv/Include/Photo.jpg

", 'rb'))

Wrote in python using the Telebot library

? Tried to just copy the path which is on the server, but nothing happens.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Karbivnichy, 2021-02-16
@TeleQuest123

What path should I show now?

Relative.

V
Vasily Bannikov, 2021-02-16
@vabka

It is obvious to specify the path where the files are located on the server.
If the pictures are in the folder with the bot, then it is better to use relative paths

A
Alex K, 2021-02-16
@alexk111

Tried to just copy the path which is on the server, but nothing happens.

Some error was made while copying the path to the file on the server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question