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

UnicodeEncodeError: 'ascii' #436

Closed
acigolotti opened this issue Sep 27, 2012 · 10 comments
Closed

UnicodeEncodeError: 'ascii' #436

acigolotti opened this issue Sep 27, 2012 · 10 comments
Labels
bug

Comments

@acigolotti
Copy link

@acigolotti acigolotti commented Sep 27, 2012

C:\Users\******>youtube-dl.py -ti "http://www.youtube.com/watch?v=7tfwQE4qvbI&fe
ature=watch-now-button&wide=1"
[youtube] Setting language
[youtube] 7tfwQE4qvbI: Downloading video webpage
[youtube] 7tfwQE4qvbI: Downloading video info webpage
[youtube] 7tfwQE4qvbI: Extracting video information
[youtube] RTMP download detected
[download] Destination: ____American_Daughter-7tfwQE4qvbI.flv
Traceback (most recent call last):
File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
File "C:\Python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
File "C:\Users\******\Commands\youtube-dl.py\__main__.py", line 7, in <module>

File "C:\Users\******\Commands\youtube-dl.py\__init__.py", line 547, in main
File "C:\Users\******\Commands\youtube-dl.py\__init__.py", line 531, in _real_
main
File "C:\Users\******\Commands\youtube-dl.py\FileDownloader.py", line 479, in
download
File "C:\Users\******\Commands\youtube-dl.py\FileDownloader.py", line 442, in
process_info
File "C:\Users\******\Commands\youtube-dl.py\FileDownloader.py", line 556, in
_do_download
File "C:\Users\******\Commands\youtube-dl.py\FileDownloader.py", line 523, in
_download_with_rtmpdump
File "C:\Python27\lib\subprocess.py", line 493, in call
    return Popen(*popenargs, **kwargs).wait()
File "C:\Python27\lib\subprocess.py", line 679, in __init__
    errread, errwrite)
File "C:\Python27\lib\subprocess.py", line 896, in _execute_child
    startupinfo)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 65-76: ord
inal not in range(128)

rtmpdump 2.4
Windows7 64bits
python 2.7.3
C:\Users******>youtube-dl.py --update
Updating to latest version...
youtube-dl is up-to-date (2012.09.27)

Sorry but I'm french and I don't speak english very well but I have this bug and and don't know what to do and I have read this: #264 (comment) so I open this.

@phihag
Copy link
Contributor

@phihag phihag commented Sep 27, 2012

Mmm, we're definitely passing a unicode object to subprocess.call, and it seems to get confused. I cannot reproduce the error on Linux. I'm a little bit suspicious because the file name should be Американская_дочь___American_Daughter-7tfwQE4qvbI.flv, and that gets completely garbled in your output.

Can anyone with a Windows machine verify the error? Do we need to restrict Windows file names to ASCII only?

Anyway, thanks for reporting this issue, @BomberCraft . We'll look into it.

@Tailszefox
Copy link
Contributor

@Tailszefox Tailszefox commented Sep 27, 2012

Confirmed on a Windows XP machine running with Python 2.6.6 and the latest version of the script:

C:\Documents and Settings\Tails\Bureau\youtube-dl>youtube-dl.py -ti -v "http://www.youtube.com/watch?v=7tfwQE4qvbI&fe"
[debug] Proxy map: {}
[youtube] Setting language
[youtube] 7tfwQE4qvbI: Downloading video webpage
[youtube] 7tfwQE4qvbI: Downloading video info webpage
[youtube] 7tfwQE4qvbI: Extracting video information
[youtube] RTMP download detected
[download] Destination: ____American_Daughter-7tfwQE4qvbI.flv
[debug] rtmpdump command line: rtmpdump -q -r rtmpe://v23.nonxt3.c.youtube.com/videoplayback -o '____American_Daughter-7tfwQE4qvbI.flv.part' -e -k 1
Traceback (most recent call last):
  File "C:\Documents and Settings\Tails\Bureau\youtube-dl\youtube-dl\__main__.py", line 7, in <module>
    __init__.main()
  File "C:\Documents and Settings\Tails\Bureau\youtube-dl\youtube-dl\__init__.py", line 547, in main
    _real_main()
  File "C:\Documents and Settings\Tails\Bureau\youtube-dl\youtube-dl\__init__.py", line 531, in _real_main
    retcode = fd.download(all_urls)
  File "C:\Documents and Settings\Tails\Bureau\youtube-dl\youtube-dl\FileDownloader.py", line 479, in download
    self.process_info(video)
  File "C:\Documents and Settings\Tails\Bureau\youtube-dl\youtube-dl\FileDownloader.py", line 442, in process_info
    success = self._do_download(filename, info_dict)
  File "C:\Documents and Settings\Tails\Bureau\youtube-dl\youtube-dl\FileDownloader.py", line 556, in _do_download
    return self._download_with_rtmpdump(filename, url, player_url)
  File "C:\Documents and Settings\Tails\Bureau\youtube-dl\youtube-dl\FileDownloader.py", line 523, in _download_with_rtmpdump
    retval = subprocess.call(args)
  File "C:\Python26\lib\subprocess.py", line 470, in call
    return Popen(*popenargs, **kwargs).wait()
  File "C:\Python26\lib\subprocess.py", line 623, in __init__
    errread, errwrite)
  File "C:\Python26\lib\subprocess.py", line 833, in _execute_child
    startupinfo)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 65-76: ordinal not in range(128)

Printing the "args" object passed to subprocess.call yields this. I would guess that it doesn't like the Unicode characters in there:

['rtmpdump', '-q', '-r', u'rtmpe://v23.nonxt3.c.youtube.com/videoplayback', '-o', u'\u0410\u043c\u0435\u0440\u0438\u043a\u0430\u043d\u0441\u043a\u0430
\u044f_\u0434\u043e\u0447\u044c___American_Daughter-7tfwQE4qvbI.flv.part', '-e', '-k', '1']
@acigolotti
Copy link
Author

@acigolotti acigolotti commented Sep 27, 2012

Thank you, but without the -t argument, it should no longer be any Unicode character but the video still doesn't want to download:
C:\Users******>youtube-dl.py -v "http://www.youtube.com/watch?v=7tfwQE4qvbI&feature=watch-now-button&wide=1"
[debug] Proxy map: {}
[youtube] Setting language
[youtube] 7tfwQE4qvbI: Downloading video webpage
[youtube] 7tfwQE4qvbI: Downloading video info webpage
[youtube] 7tfwQE4qvbI: Extracting video information
[youtube] RTMP download detected
[download] Destination: 7tfwQE4qvbI.flv
[debug] rtmpdump command line: rtmpdump -q -r rtmpe://v23.nonxt3.c.youtube.com/v
ideoplayback -o 7tfwQE4qvbI.flv.part -e -k 1

ERROR: unable to download video

Is this an another bug?
And on linux it still doesn't download the video, it seems to be Gnone-keyring problem but there is no relation with youtube-dl I think.

@Tailszefox
Copy link
Contributor

@Tailszefox Tailszefox commented Sep 27, 2012

Yeah, unfortunately even without the -t argument, I think you hit bug #343 since the video uses RTMP. That's another issue entirely as far as I can tell.

@yasoob
Copy link
Contributor

@yasoob yasoob commented Jun 24, 2013

@BomberCraft for the ascii issue you can use --restrict-filenames flag. It will deal with the ascii problems. I hope this helps. 👍

@yasoob
Copy link
Contributor

@yasoob yasoob commented Jul 1, 2013

@BomberCraft did --restrict-filenames help ?

@acigolotti
Copy link
Author

@acigolotti acigolotti commented Jul 1, 2013

Sorry, but It's been a long time since I've no longer download videos with special characters in the title, so I haven't tested the --restrict-filenames argument.

@yasoob
Copy link
Contributor

@yasoob yasoob commented Jul 1, 2013

@BomberCraft plz check it so that we can know that this issue is resolved and so we can close this issue. :)

@acigolotti
Copy link
Author

@acigolotti acigolotti commented Jul 1, 2013

It seems to be resolved, I can't have this error again, I try download some russian video with the -t argument and all the unicode character have been delete in the title, so it works now. maybe....

@yasoob
Copy link
Contributor

@yasoob yasoob commented Jul 2, 2013

@phihag this issue is resolved now. It's good to close.

@phihag phihag closed this Jul 2, 2013
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
4 participants
You can’t perform that action at this time.