@ReDeNDeR

Telebot не присылает видео что делать?

Я пытаюсь прислать видео с помощью telebot но получаю исключения.

Код:
import telebot

bot = telebot.TeleBot("TOKEN", parse_mode=None)

@bot.message_handler(commands=['start', 'help'])
def send_welcome(message):
    video = open('video.mp4', 'rb')
    bot.send_video(message.chat.id, video)

bot.polling()


Исключения:
Traceback (most recent call last):
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 670, in urlopen
httplib_response = self._make_request(
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 392, in _make_request
conn.request(method, url, **httplib_request_kw)
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 1255, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 1301, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 1250, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 1049, in _send_output
self.send(chunk)
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 971, in send
self.sock.sendall(data)
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\ssl.py", line 1204, in sendall
v = self.send(byte_view[count:])
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\ssl.py", line 1173, in send
return self._sslobj.write(data)
socket.timeout: The write operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\adapters.py", line 439, in send
resp = conn.urlopen(
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 726, in urlopen
retries = retries.increment(
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\util\retry.py", line 410, in increment
raise six.reraise(type(error), error, _stacktrace)
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\packages\six.py", line 734, in reraise
raise value.with_traceback(tb)
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 670, in urlopen
httplib_response = self._make_request(
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 392, in _make_request
conn.request(method, url, **httplib_request_kw)
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 1255, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 1301, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 1250, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 1049, in _send_output
self.send(chunk)
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 971, in send
self.sock.sendall(data)
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\ssl.py", line 1204, in sendall
v = self.send(byte_view[count:])
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\ssl.py", line 1173, in send
return self._sslobj.write(data)
urllib3.exceptions.ProtocolError: ('Connection aborted.', timeout('The write operation timed out'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Rasul\Desktop\Newfolder\phposter.py", line 10, in
bot.polling()
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\__init__.py", line 455, in polling
self.__threaded_polling(none_stop, interval, timeout, long_polling_timeout)
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\__init__.py", line 513, in __threaded_polling
raise e
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\__init__.py", line 479, in __threaded_polling
self.worker_pool.raise_exceptions()
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\util.py", line 118, in raise_exceptions
raise self.exception_info
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\util.py", line 69, in run
task(*args, **kwargs)
File "C:\Users\Rasul\Desktop\Newfolder\phposter.py", line 8, in send_welcome
bot.send_video(message.chat.id, video)
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\__init__.py", line 877, in send_video
apihelper.send_video(self.token, chat_id, data, duration, caption, reply_to_message_id, reply_markup,
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\apihelper.py", line 521, in send_video
return _make_request(token, method_url, params=payload, files=files, method='post')
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\apihelper.py", line 107, in _make_request
result = _get_req_session().request(
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "C:\Users\Rasul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\adapters.py", line 498, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', timeout('The write operation timed out'))
  • Вопрос задан
  • 94 просмотра
Пригласить эксперта
Ответы на вопрос 1
@Wispik
попробуй таймаут добавить
bot.send_video(message.chat.id, video, timeout=100)
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы