Answer the question
In order to leave comments, you need to log in
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
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question