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

ascii codec can't encode characters in positions 0-2: ordinal not in range (128) #2450

Closed
Jimmm opened this issue Feb 24, 2014 · 13 comments
Closed

Comments

@Jimmm
Copy link
Author

@Jimmm Jimmm commented Feb 24, 2014

I use windows 7 32 bit German. Playlist is in Russian, but it is the only one with such an error.

@phihag
Copy link
Contributor

@phihag phihag commented Feb 24, 2014

Can you post entire output you get when using the -v option? Downloading this playlist works fine for me.

@Jimmm
Copy link
Author

@Jimmm Jimmm commented Feb 24, 2014

my bad, i forgot to mention, that I use:
youtube-dl --batch-file "Playlist_Realnames.txt"

Playlist_Realnames.txt:
http://www.youtube.com/playlist?list=PL1AENDDEdvRDXil0LVcC-lPOP4-7Kt7Ha

If I download it directly (URL as parameter) it works fine.

Output:
WARNING: The url doesn't specify the protocol, trying with http
[generic] playlist?list=PL1AENDDEdvRDXil0LVcC-lPOP4-7Kt7Ha: Requesting header
Traceback (most recent call last):
File "main.py", line 18, in
File "youtube_dl__init__.pyo", line 804, in main
File "youtube_dl__init__.pyo", line 794, in _real_main
File "youtube_dl\YoutubeDL.pyo", line 982, in download
File "youtube_dl\YoutubeDL.pyo", line 510, in extract_info
File "youtube_dl\YoutubeDL.pyo", line 546, in process_ie_result
File "youtube_dl\YoutubeDL.pyo", line 493, in extract_info
File "youtube_dl\extractor\common.pyo", line 158, in extract
File "youtube_dl\extractor\generic.pyo", line 204, in _real_extract
File "youtube_dl\extractor\generic.pyo", line 159, in _send_head
File "urllib2.pyo", line 404, in open
File "urllib2.pyo", line 422, in _open
File "urllib2.pyo", line 382, in _call_chain
File "urllib2.pyo", line 1214, in http_open
File "urllib2.pyo", line 1181, in do_open
File "httplib.pyo", line 973, in request
File "httplib.pyo", line 1006, in _send_request
File "httplib.pyo", line 953, in putheader
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordin
al not in range(128)

@Jimmm
Copy link
Author

@Jimmm Jimmm commented Feb 24, 2014

Another urls in Playlist_Realnames.txt (I deleted them already from txt) work fine, but this one is always skipped.

@phihag
Copy link
Contributor

@phihag phihag commented Feb 24, 2014

This output is still missing a couple of lines. The output should start with [debug] System config:. Also, can you upload the file Playlist_Realnames.txt somewhere? I strongly suspect that there is a strange character in there.

@Jimmm
Copy link
Author

@Jimmm Jimmm commented Feb 24, 2014

[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-v', '--batch-file', 'Playlist_Realnames.txt']
[debug] Encodings: locale 'cp1251', fs 'mbcs', out 'cp866', pref: 'cp1251'
[debug] Batch file urls: ['\xef\xbb\xbfhttp://www.youtube.com/playlist?list=PL1A
ENDDEdvRDXil0LVcC-lPOP4-7Kt7Ha']
[debug] youtube-dl version 2014.02.22
[debug] Python version 2.7.5 - Windows-7-6.1.7601-SP1
[debug] Proxy map: {}
WARNING: The url doesn't specify the protocol, trying with http
[generic] playlist?list=PL1AENDDEdvRDXil0LVcC-lPOP4-7Kt7Ha: Requesting header
Traceback (most recent call last):
File "main.py", line 18, in
File "youtube_dl__init__.pyo", line 804, in main
File "youtube_dl__init__.pyo", line 794, in _real_main
File "youtube_dl\YoutubeDL.pyo", line 982, in download
File "youtube_dl\YoutubeDL.pyo", line 510, in extract_info
File "youtube_dl\YoutubeDL.pyo", line 546, in process_ie_result
File "youtube_dl\YoutubeDL.pyo", line 493, in extract_info
File "youtube_dl\extractor\common.pyo", line 158, in extract
File "youtube_dl\extractor\generic.pyo", line 204, in _real_extract
File "youtube_dl\extractor\generic.pyo", line 159, in _send_head
File "urllib2.pyo", line 404, in open
File "urllib2.pyo", line 422, in _open
File "urllib2.pyo", line 382, in _call_chain
File "urllib2.pyo", line 1214, in http_open
File "urllib2.pyo", line 1181, in do_open
File "httplib.pyo", line 973, in request
File "httplib.pyo", line 1006, in _send_request
File "httplib.pyo", line 953, in putheader
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordin
al not in range(128)

@Jimmm
Copy link
Author

@Jimmm Jimmm commented Feb 24, 2014

what does it mean: \xef\xbb\xbf

@phihag
Copy link
Contributor

@phihag phihag commented Feb 24, 2014

That's a BOM (which shouldn't happen on your platform since you're not even using a Unicode encoding). I'll look into how we can ignore it.

@Jimmm
Copy link
Author

@Jimmm Jimmm commented Feb 24, 2014

This is strange, I downloaded over 100 playlists using "Playlist_Realnames.txt" and only this one gave an error.

@phihag
Copy link
Contributor

@phihag phihag commented Feb 24, 2014

Yes, the BOM is only in the very first line of the file, so that's expected.

@Jimmm
Copy link
Author

@Jimmm Jimmm commented Feb 24, 2014

I opened my older Playlist_Realnames.txt and it is shown as "ANSI as UTF-8" in Notepad++. But this one is just "UTF-8".

@phihag phihag closed this in 62e609a Feb 25, 2014
@phihag
Copy link
Contributor

@phihag phihag commented Feb 25, 2014

Thank you for the report. This has been fixed in youtube-dl 2014.02.25. Type youtube-dl -U to update.

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.