Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #98622
| From | Tim Johnson <tim@akwebsoft.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Using subprocess to capture a progress line |
| Date | 2015-11-10 14:51 -0900 |
| Organization | AkWebsoft |
| Message-ID | <mailman.228.1447199464.16136.python-list@python.org> (permalink) |
| References | <20151110224756.GA1944@mail.akwebsoft.com> <CAPTjJmrhYG5xL_Kru8Jr7R=exvp6caooQ4U2HDJByvVaTsi=sA@mail.gmail.com> |
* Chris Angelico <rosuav@gmail.com> [151110 14:35]: > On Wed, Nov 11, 2015 at 9:47 AM, Tim Johnson <tim@akwebsoft.com> wrote: > > I've written a command-line "wrapper" for youtube-dl, executing > > youtube-dl as a subprocess. > > > > ------------------------------------------------------------------ > > youtube-dl reports download progress on one line. I.E. the line is > > overwritten numerous times with no carriage return until the > > downloading is finished. > > ------------------------------------------------------------------ > > > > Sounds to me like a possible buffering problem. But since youtube-dl > is implemented in Python, you might find it easier to "pip install > youtube_dl" and work with the methods directly: > > >>> import youtube_dl > >>> youtube_dl.YoutubeDL().download(["m39ydsOPSww"]) Frankly, I'd prefer - in the long run - to use youtube_dl (the module). But, when I do as you have suggested (and have tried previously) I get the following: youtube_dl.utils.DownloadError: ERROR: no suitable InfoExtractor I've briefly researched the error and so far haven't come up with an solution - guessing that other setup code is needed ... As for the buffering issue, at this point, I'll try using a lower-level function like sys.stdout.write when the line tests for '[download]' and 'ETA'. :) more elegant solutions welcome. I do intend to investigate using youtube_dl, once subprocess has been dealt with. thanks for the quick reply -- Tim http://www.akwebsoft.com, http://www.tj49.com
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Using subprocess to capture a progress line Tim Johnson <tim@akwebsoft.com> - 2015-11-10 14:51 -0900
csiph-web