Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

struct.error: unpack requires a string argument of length 4 #2807

Closed
lkw2011 opened this issue Apr 25, 2014 · 3 comments
Closed

struct.error: unpack requires a string argument of length 4 #2807

lkw2011 opened this issue Apr 25, 2014 · 3 comments

Comments

@lkw2011
Copy link

@lkw2011 lkw2011 commented Apr 25, 2014

/usr/local/bin/youtube-dl --verbose --proxy http://lab:8134 --ignore-config --sub-lang en --write-auto-sub -o "%(title)s.%(ext)s" -f '38/37/46/22/45/35/44/18/34/43/6/5/17/13' VebOTc-7shU

[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['--verbose', '--proxy', 'http://lab:8134', '--ignore-config', '--sub-lang', 'en', '--write-auto-sub', '-o', '%(title)s.%(ext)s', '-f', '38/37/46/22/45/35/44/18/34/43/6/5/17/13', 'VebOTc-7shU']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2014.04.21.6
[debug] Python version 2.7.6 - Linux-3.13.0-24-generic-x86_64-with-Ubuntu-14.04-trusty
[debug] Proxy map: {u'http': 'http://lab:8134', u'https': 'http://lab:8134'}
[youtube] Setting language
[youtube] VebOTc-7shU: Downloading webpage
[youtube] VebOTc-7shU: Downloading video info webpage
[youtube] VebOTc-7shU: Extracting video information
[youtube] VebOTc-7shU: Looking for automatic captions
[youtube] VebOTc-7shU: Downloading XML
Traceback (most recent call last):
File "/usr/local/bin/youtube-dl", line 9, in
load_entry_point('youtube-dl==2014.04.21.6', 'console_scripts', 'youtube-dl')()
File "/usr/local/lib/python2.7/dist-packages/youtube_dl-2014.04.21.6-py2.7.egg/youtube_dl/init.py", line 845, in main
_real_main(argv)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl-2014.04.21.6-py2.7.egg/youtube_dl/init.py", line 835, in _real_main
retcode = ydl.download(all_urls)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl-2014.04.21.6-py2.7.egg/youtube_dl/YoutubeDL.py", line 1036, in download
self.extract_info(url)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl-2014.04.21.6-py2.7.egg/youtube_dl/YoutubeDL.py", line 514, in extract_info
ie_result = ie.extract(url)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl-2014.04.21.6-py2.7.egg/youtube_dl/extractor/common.py", line 161, in extract
return self._real_extract(url)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl-2014.04.21.6-py2.7.egg/youtube_dl/extractor/youtube.py", line 1175, in _real_extract
video_subtitles = self.extract_subtitles(video_id, video_webpage)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl-2014.04.21.6-py2.7.egg/youtube_dl/extractor/subtitles.py", line 60, in extract_subtitles
subtitle = self._request_subtitle_url(sub_lang, url)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl-2014.04.21.6-py2.7.egg/youtube_dl/extractor/subtitles.py", line 71, in _request_subtitle_url
sub = self._download_subtitle_url(sub_lang, url)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl-2014.04.21.6-py2.7.egg/youtube_dl/extractor/subtitles.py", line 66, in _download_subtitle_url
return self._download_webpage(url, None, note=False)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl-2014.04.21.6-py2.7.egg/youtube_dl/extractor/common.py", line 273, in _download_webpage
res = self._download_webpage_handle(url_or_request, video_id, note, errnote, fatal)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl-2014.04.21.6-py2.7.egg/youtube_dl/extractor/common.py", line 214, in _download_webpage_handle
urlh = self._request_webpage(url_or_request, video_id, note, errnote, fatal)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl-2014.04.21.6-py2.7.egg/youtube_dl/extractor/common.py", line 194, in _request_webpage
return self._downloader.urlopen(url_or_request)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl-2014.04.21.6-py2.7.egg/youtube_dl/YoutubeDL.py", line 1211, in urlopen
return self._opener.open(req, timeout=self._socket_timeout)
File "/usr/lib/python2.7/urllib2.py", line 410, in open
response = meth(req, response)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl-2014.04.21.6-py2.7.egg/youtube_dl/utils.py", line 742, in http_response
uncompressed = io.BytesIO(gz.read())
File "/usr/lib/python2.7/gzip.py", line 254, in read
self._read(readsize)
File "/usr/lib/python2.7/gzip.py", line 325, in _read
self._read_eof()
File "/usr/lib/python2.7/gzip.py", line 344, in _read_eof
isize = read32(self.fileobj) # may exceed 2GB
File "/usr/lib/python2.7/gzip.py", line 25, in read32
return struct.unpack("<I", input.read(4))[0]
struct.error: unpack requires a string argument of length 4

I look at: https://groups.google.com/forum/#!topic/python-excel/kwR9sDf_SJY and follow it, but not work, please help, thanks.

@lkw2011
Copy link
Author

@lkw2011 lkw2011 commented Apr 25, 2014

It seems that file is too large? Small file is no problem.

@phihag
Copy link
Contributor

@phihag phihag commented Apr 26, 2014

Does the problem occur when you don't use your proxy, i.e. pass --proxy '' into youtube-dl?

@phihag
Copy link
Contributor

@phihag phihag commented Apr 30, 2014

After a closer look at the code, I'm certain that this error is caused by your proxy mishandling a URL (to be precise, it serves only a couple of bytes instead of the whole file). I'm closing this issue for now. If you want us to reopen it, please post a comment, if possible with the make of the proxy server.

@phihag phihag closed this Apr 30, 2014
@arulrajnet arulrajnet mentioned this issue Aug 4, 2016
5 of 8 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.