Answer the question
In order to leave comments, you need to log in
Why is urllib not downloading the file?
When using this function on Windows, everything worked fine, as soon as I switched to Ubuntu, such errors appeared urllib.error.ContentTooShortError: urlopen error retrieval incomplete: got only 81638 out of 2808891 bytes
Exception in thread Thread-89:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3. 8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "main.py", line 469, in _load_snaptik
urllib.request.urlretrieve(url, _name_file + " .mp4")
File "/usr/lib/python3.8/urllib/request.py", line 286, in urlretrieve
raise ContentTooShortError(
urllib.error.ContentTooShortError:
opener = urllib.request.build_opener()
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
urllib.request.install_opener(opener)
try:
urllib.request.urlretrieve(url, _name_file + ".mp4")
except TypeError:
msg = _token_bot.send_message(message.chat.id, "⚠Данная ссылка недействительна, введите другую.⚠")
return _token_bot.register_next_step_handler(msg, _search_url)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question