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

"[debug]" line goes in stdout. #14579

Open
casinero opened this issue Oct 24, 2017 · 3 comments
Open

"[debug]" line goes in stdout. #14579

casinero opened this issue Oct 24, 2017 · 3 comments
Labels
bug

Comments

@casinero
Copy link

@casinero casinero commented Oct 24, 2017

When I do
youtube-dl.exe --no-playlist -v -J -i ANY_YOUTUBE_VIDEO_URL 1>ytdl.stdout.log 2>ytdl.stderr.log
Following lines are in ytdl.stderr.log:

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--no-playlist', '-v', '-J', '-i', 'https://www.youtube.com/watch?v=Ocsl3bVsJZ8']
[debug] Encodings: locale cp950, fs mbcs, out cp950, pref cp950
[debug] youtube-dl version 2017.10.20
[debug] Python version 3.4.4 - Windows-10-10.0.15063
[debug] exe versions: ffmpeg N-70348-g9564375, ffprobe N-70348-g9564375
[debug] Proxy map: {}

And ytdl.stdout.log:

[debug] Default format spec: bestvideo+bestaudio/best
{"playlist": null, "view_count": 788201, "thumbnail": ......}

Shouldn't the [debug] Default format spec: bestvideo+bestaudio/best line be output through stderr, consistent with other [debug] lines?

I'm asking this because this behaviour change makes it difficult to capture JSON output in a wrapper program.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Oct 25, 2017

This should go away with #10894 implemented.

@yan12125 yan12125 added the request label Oct 25, 2017
@robbiemorrison
Copy link

@robbiemorrison robbiemorrison commented Jan 7, 2019

This bug is still present I believe .. over one year on.

I am running the latest Ubuntu version. Ubuntu will not let me upgrade using -U.

The following youtube-dl output is interspersed with indented output from my bash script:

      name call : youtube-dl --verbose --no-overwrites --prefer-free-formats --get-filename --output "2018-thun-vid.%(ext)s" https://www.youtube.com/watch?v=EAmmUIEsN9A
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--verbose', '--no-overwrites', '--prefer-free-formats', '--get-filename', '--output', '2018-thun-vid.%(ext)s', 'https://www.youtube.com/watch?v=EAmmUIEsN9A']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.09.10
[debug] Python version 3.6.7 (CPython) - Linux-4.18.0-13-generic-x86_64-with-Ubuntu-18.10-cosmic
[debug] exe versions: ffmpeg 4.0.2-2, ffprobe 4.0.2-2, phantomjs 2.1.1, rtmpdump 2.4
[debug] Proxy map: {}
    exit status : 0
    output name : [debug] Default format spec: bestvideo+bestaudio/best
2018-thun-vid.webm
    information : script ends

The offending line that prints to stdout not stderr is:

[debug] Default format spec: bestvideo+bestaudio/best

This faulty output includes a trailing newline.

thanks to the developers and with best wishes, Robbie

@d-g
Copy link

@d-g d-g commented Jul 6, 2019

Dear maintainers and @yan12125 specifically,

may I ask, why this is marked as a feature request?

For anyone barely familiar with CLI, it’s obvious, that debug output has nothing to do with stdout, so observed behaviour is highly unexpected.

And this unexpected behaviour indeed harms usability: as --verbose option in config cannot be reversed on command line: --no-verbose does not exists and --quiet is simply ignored (which is possibly a bug by itself, but nevertheless), it became impossible to sketch a program that invokes youtube-dl(1) and respects user configuration — we can only ignore it completely.

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.